Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Accordion

    Collapsible sections built on native details and summary, no JavaScript needed.

    How long does shipping take?
    Orders arrive in 2 to 4 business days.
    Which payment methods are available?
    Bank transfer, credit card, and digital wallets.
    How do I return an item?
    Request a return within 7 days from the order page.
    How long does shipping take?
    Orders arrive in 2 to 4 business days.
    Which payment methods are available?
    Bank transfer, credit card, and digital wallets.
    How do I return an item?
    Request a return within 7 days from the order page.
    How long does shipping take?
    Orders arrive in 2 to 4 business days.
    Which payment methods are available?
    Bank transfer, credit card, and digital wallets.
    How do I return an item?
    Request a return within 7 days from the order page.
    How long does shipping take?
    Orders arrive in 2 to 4 business days.
    Which payment methods are available?
    Bank transfer, credit card, and digital wallets.
    How do I return an item?
    Request a return within 7 days from the order page.
    How long does shipping take?
    Orders arrive in 2 to 4 business days.
    Which payment methods are available?
    Bank transfer, credit card, and digital wallets.
    How do I return an item?
    Request a return within 7 days from the order page.
    <x-markas.accordion :items="['shipping' => 'How long does shipping take?', 'payment' => 'Which payment methods are available?', 'returns' => 'How do I return an item?']" default-value="shipping">
        <x-slot:shipping>Orders arrive in 2 to 4 business days.</x-slot:shipping>
        <x-slot:payment>Bank transfer, credit card, and digital wallets.</x-slot:payment>
        <x-slot:returns>Request a return within 7 days from the order page.</x-slot:returns>
    </x-markas.accordion>
    import { Accordion } from "@/components/markas/Accordion";
    
    const items = [
      {
        value: "shipping",
        title: "How long does shipping take?",
        content: "Orders arrive in 2 to 4 business days.",
      },
      {
        value: "payment",
        title: "Which payment methods are available?",
        content: "Bank transfer, credit card, and digital wallets.",
      },
      {
        value: "returns",
        title: "How do I return an item?",
        content: "Request a return within 7 days from the order page.",
      },
    ];
    
    export default function AccordionExample() {
      return <Accordion items={items} defaultValue="shipping" />;
    }
    <script setup lang="ts">
    import Accordion from "@/components/markas/Accordion.vue";
    
    const items = [
      { value: "shipping", title: "How long does shipping take?" },
      { value: "payment", title: "Which payment methods are available?" },
      { value: "returns", title: "How do I return an item?" },
    ];
    </script>
    
    <template>
      <Accordion :items="items" default-value="shipping">
        <template #shipping>Orders arrive in 2 to 4 business days.</template>
        <template #payment
          >Bank transfer, credit card, and digital wallets.</template
        >
        <template #returns
          >Request a return within 7 days from the order page.</template
        >
      </Accordion>
    </template>
    <script lang="ts">
      import Accordion from "$lib/components/markas/Accordion.svelte";
    
      const items = [
        {
          value: "shipping",
          title: "How long does shipping take?",
          content: "Orders arrive in 2 to 4 business days.",
        },
        {
          value: "payment",
          title: "Which payment methods are available?",
          content: "Bank transfer, credit card, and digital wallets.",
        },
        {
          value: "returns",
          title: "How do I return an item?",
          content: "Request a return within 7 days from the order page.",
        },
      ];
    </script>
    
    <Accordion {items} defaultValue="shipping" />
    ---
    import Accordion from "@/components/markas/Accordion.astro";
    
    const items = [
      {
        value: "shipping",
        title: "How long does shipping take?",
        content: "Orders arrive in 2 to 4 business days.",
      },
      {
        value: "payment",
        title: "Which payment methods are available?",
        content: "Bank transfer, credit card, and digital wallets.",
      },
      {
        value: "returns",
        title: "How do I return an item?",
        content: "Request a return within 7 days from the order page.",
      },
    ];
    ---
    
    <Accordion items={items} defaultValue="shipping" />
    import { Component } from "@angular/core";
    import { Accordion } from "./markas/accordion.component";
    
    @Component({
      selector: "markas-example",
      imports: [Accordion],
      template: `<markas-accordion [items]="items" defaultValue="shipping" />`,
    })
    export default class AccordionExample {
      protected readonly items = [
        {
          value: "shipping",
          title: "How long does shipping take?",
          content: "Orders arrive in 2 to 4 business days.",
        },
        {
          value: "payment",
          title: "Which payment methods are available?",
          content: "Bank transfer, credit card, and digital wallets.",
        },
        {
          value: "returns",
          title: "How do I return an item?",
          content: "Request a return within 7 days from the order page.",
        },
      ];
    }

    Examples

    Multiple open

    Account
    Update your name, email, and profile photo.
    Billing
    Manage your plan, payment method, and invoices.
    Security
    Turn on two-step verification and review active sessions.
    Account
    Update your name, email, and profile photo.
    Billing
    Manage your plan, payment method, and invoices.
    Security
    Turn on two-step verification and review active sessions.
    Account
    Update your name, email, and profile photo.
    Billing
    Manage your plan, payment method, and invoices.
    Security
    Turn on two-step verification and review active sessions.
    Account
    Update your name, email, and profile photo.
    Billing
    Manage your plan, payment method, and invoices.
    Security
    Turn on two-step verification and review active sessions.
    Account
    Update your name, email, and profile photo.
    Billing
    Manage your plan, payment method, and invoices.
    Security
    Turn on two-step verification and review active sessions.

    FAQ

    Frequently asked questions

    Still have questions? Contact our support team.

    Is there a free trial?
    Yes. Every plan starts with a 14 day trial, no card required.
    Can I cancel at any time?
    Yes. Your plan stays active until the end of the billing period.
    Can I invite my team?
    Invite as many members as your plan allows from the team settings.
    Where is my data stored?
    Data is stored in Jakarta and backed up every day.

    Frequently asked questions

    Still have questions? Contact our support team.

    Is there a free trial?
    Yes. Every plan starts with a 14 day trial, no card required.
    Can I cancel at any time?
    Yes. Your plan stays active until the end of the billing period.
    Can I invite my team?
    Invite as many members as your plan allows from the team settings.
    Where is my data stored?
    Data is stored in Jakarta and backed up every day.

    Frequently asked questions

    Still have questions? Contact our support team.

    Is there a free trial?
    Yes. Every plan starts with a 14 day trial, no card required.
    Can I cancel at any time?
    Yes. Your plan stays active until the end of the billing period.
    Can I invite my team?
    Invite as many members as your plan allows from the team settings.
    Where is my data stored?
    Data is stored in Jakarta and backed up every day.

    Frequently asked questions

    Still have questions? Contact our support team.

    Is there a free trial?
    Yes. Every plan starts with a 14 day trial, no card required.
    Can I cancel at any time?
    Yes. Your plan stays active until the end of the billing period.
    Can I invite my team?
    Invite as many members as your plan allows from the team settings.
    Where is my data stored?
    Data is stored in Jakarta and backed up every day.

    Frequently asked questions

    Still have questions? Contact our support team.

    Is there a free trial?
    Yes. Every plan starts with a 14 day trial, no card required.
    Can I cancel at any time?
    Yes. Your plan stays active until the end of the billing period.
    Can I invite my team?
    Invite as many members as your plan allows from the team settings.
    Where is my data stored?
    Data is stored in Jakarta and backed up every day.

    In a card

    Order summary
    3 items, total $86.00 including tax.
    Shipping address
    Jl. Merdeka No. 12, Bandung, West Java 40111.
    Payment method
    Visa ending in 4242, expires 08/28.
    Order summary
    3 items, total $86.00 including tax.
    Shipping address
    Jl. Merdeka No. 12, Bandung, West Java 40111.
    Payment method
    Visa ending in 4242, expires 08/28.
    Order summary
    3 items, total $86.00 including tax.
    Shipping address
    Jl. Merdeka No. 12, Bandung, West Java 40111.
    Payment method
    Visa ending in 4242, expires 08/28.
    Order summary
    3 items, total $86.00 including tax.
    Shipping address
    Jl. Merdeka No. 12, Bandung, West Java 40111.
    Payment method
    Visa ending in 4242, expires 08/28.
    Order summary
    3 items, total $86.00 including tax.
    Shipping address
    Jl. Merdeka No. 12, Bandung, West Java 40111.
    Payment method
    Visa ending in 4242, expires 08/28.

    Rich content

    What is included in the Pro plan?
    • Up to 10 team members
    • 50 GB of storage
    • Priority email support
    How do I upgrade?
    Open the billing page and choose a new plan.
    What is included in the Pro plan?
    • Up to 10 team members
    • 50 GB of storage
    • Priority email support
    How do I upgrade?
    Open the billing page and choose a new plan.
    What is included in the Pro plan?
    • Up to 10 team members
    • 50 GB of storage
    • Priority email support
    How do I upgrade?
    Open the billing page and choose a new plan.
    What is included in the Pro plan?
    • Up to 10 team members
    • 50 GB of storage
    • Priority email support
    How do I upgrade?
    Open the billing page and choose a new plan.
    What is included in the Pro plan?
    • Up to 10 team members
    • 50 GB of storage
    • Priority email support
    How do I upgrade?
    Open the billing page and choose a new plan.

    Installation

    npx markasui@latest add accordion

    Usage

    <x-markas.accordion :items="['shipping' => 'How long does shipping take?', 'returns' => 'How do I return an item?']" default-value="shipping">
        <x-slot:shipping>Orders arrive in 2 to 4 business days.</x-slot:shipping>
        <x-slot:returns>Request a return within 7 days from the order page.</x-slot:returns>
    </x-markas.accordion>

    No Alpine.js needed.

    import { Accordion } from "@/components/markas/Accordion";
    
    <Accordion
      defaultValue="shipping"
      items={[
        {
          value: "shipping",
          title: "How long does shipping take?",
          content: "Orders arrive in 2 to 4 business days.",
        },
        {
          value: "returns",
          title: "How do I return an item?",
          content: "Request a return within 7 days from the order page.",
        },
      ]}
    />;
    <template>
      <Accordion
        default-value="shipping"
        :items="[
          { value: 'shipping', title: 'How long does shipping take?' },
          { value: 'returns', title: 'How do I return an item?' },
        ]"
      >
        <template #shipping>Orders arrive in 2 to 4 business days.</template>
        <template #returns
          >Request a return within 7 days from the order page.</template
        >
      </Accordion>
    </template>
    <script lang="ts">
      import Accordion from "$lib/components/markas/Accordion.svelte";
    
      const items = [
        {
          value: "shipping",
          title: "How long does shipping take?",
          content: "Orders arrive in 2 to 4 business days.",
        },
        { value: "returns", title: "How do I return an item?", content: returns },
      ];
    </script>
    
    {#snippet returns()}
      Request a return within 7 days from the <a href="/orders">order page</a>.
    {/snippet}
    
    <Accordion {items} defaultValue="shipping" />

    content takes plain text or a snippet for rich content.

    ---
    import Accordion from "@/components/markas/Accordion.astro";
    
    const items = [
      {
        value: "shipping",
        title: "How long does shipping take?",
        content: "Orders arrive in 2 to 4 business days.",
      },
      { value: "returns", title: "How do I return an item?" },
    ];
    ---
    
    <Accordion items={items} defaultValue="shipping">
      <p slot="returns">Request a return within 7 days from the order page.</p>
    </Accordion>

    An item without content renders the slot named after its value. No JavaScript is shipped.

    import { Component } from "@angular/core";
    import { Accordion } from "./markas/accordion.component";
    
    @Component({
      selector: "app-faq",
      imports: [Accordion],
      template: `
        <ng-template #returns>
          Request a return within 7 days from the <a href="/orders">order page</a>.
        </ng-template>
        <markas-accordion
          [items]="[
            {
              value: 'shipping',
              title: 'How long does shipping take?',
              content: 'Orders arrive in 2 to 4 business days.',
            },
            {
              value: 'returns',
              title: 'How do I return an item?',
              content: returns,
            },
          ]"
          defaultValue="shipping"
        />
      `,
    })
    export class Faq {}

    content takes plain text or an ng-template reference for rich content.

    • type="single" (the default) gives every details the same name attribute, so the browser closes the other sections natively. Use type="multiple" to let several sections stay open.
    • Older browsers without details[name] support still open sections, they are just not exclusive.
    • The component has no built-in text. Titles and content come from your own data, so write them in any language.

    Props

    NameTypeDefaultDescription
    itemsBlade: array<key, title> · React: { value, title, content }[] · Vue: { value, title }[] · Svelte: { value, title, content: string | Snippet }[] · Astro: { value, title, content? }[] · Angular: { value, title, content: string | TemplateRef }[][]Section list. In Blade and Vue, fill each section through a slot named after its key or value. Astro uses the same named slot when an item has no content. Svelte takes a snippet and Angular an ng-template reference for rich content.
    type'single' | 'multiple''single'single: only one section open at a time (shared name attribute on details). multiple: any number open.
    defaultValuestring | string[]-Sections open on first render. With type single only the first value is used.

    Accessibility

    • Uses native details and summary, so the summary acts as a button with an open or closed state.
    • Enter and Space on the summary open and close the section.
    • The chevron icon is aria-hidden.

    Related components

    More navigation components with the same classes in every framework.