Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Accordion

    Daftar bagian yang bisa dibuka dan ditutup, dibangun dari details dan summary native tanpa JavaScript.

    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.",
        },
      ];
    }

    Contoh

    Banyak terbuka

    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.

    Dalam 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.

    Konten kaya

    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.

    Instalasi

    npx markasui@latest add accordion

    Pemakaian

    <x-markas.accordion :items="['pengiriman' => 'Berapa lama pengiriman?', 'retur' => 'Bagaimana cara retur?']" default-value="pengiriman">
        <x-slot:pengiriman>Pesanan tiba dalam 2 sampai 4 hari kerja.</x-slot:pengiriman>
        <x-slot:retur>Ajukan retur dalam 7 hari lewat halaman pesanan.</x-slot:retur>
    </x-markas.accordion>

    Tidak butuh Alpine.js.

    import { Accordion } from "@/components/markas/Accordion";
    
    <Accordion
      defaultValue="pengiriman"
      items={[
        {
          value: "pengiriman",
          title: "Berapa lama pengiriman?",
          content: "Pesanan tiba dalam 2 sampai 4 hari kerja.",
        },
        {
          value: "retur",
          title: "Bagaimana cara retur?",
          content: "Ajukan retur dalam 7 hari lewat halaman pesanan.",
        },
      ]}
    />;
    <template>
      <Accordion
        default-value="pengiriman"
        :items="[
          { value: 'pengiriman', title: 'Berapa lama pengiriman?' },
          { value: 'retur', title: 'Bagaimana cara retur?' },
        ]"
      >
        <template #pengiriman>Pesanan tiba dalam 2 sampai 4 hari kerja.</template>
        <template #retur>Ajukan retur dalam 7 hari lewat halaman pesanan.</template>
      </Accordion>
    </template>
    <script lang="ts">
      import Accordion from "$lib/components/markas/Accordion.svelte";
    
      const items = [
        {
          value: "pengiriman",
          title: "Berapa lama pengiriman?",
          content: "Pesanan tiba dalam 2 sampai 4 hari kerja.",
        },
        { value: "retur", title: "Bagaimana cara retur?", content: retur },
      ];
    </script>
    
    {#snippet retur()}
      Ajukan retur dalam 7 hari lewat <a href="/pesanan">halaman pesanan</a>.
    {/snippet}
    
    <Accordion {items} defaultValue="pengiriman" />

    content menerima teks biasa atau snippet untuk isi kaya.

    ---
    import Accordion from "@/components/markas/Accordion.astro";
    
    const items = [
      {
        value: "pengiriman",
        title: "Berapa lama pengiriman?",
        content: "Pesanan tiba dalam 2 sampai 4 hari kerja.",
      },
      { value: "retur", title: "Bagaimana cara retur?" },
    ];
    ---
    
    <Accordion items={items} defaultValue="pengiriman">
      <p slot="retur">Ajukan retur dalam 7 hari lewat halaman pesanan.</p>
    </Accordion>

    Item tanpa content merender slot dengan nama sama seperti value-nya. Tidak ada JavaScript yang dikirim.

    import { Component } from "@angular/core";
    import { Accordion } from "./markas/accordion.component";
    
    @Component({
      selector: "app-faq",
      imports: [Accordion],
      template: `
        <ng-template #retur>
          Ajukan retur dalam 7 hari lewat <a href="/pesanan">halaman pesanan</a>.
        </ng-template>
        <markas-accordion
          [items]="[
            {
              value: 'pengiriman',
              title: 'Berapa lama pengiriman?',
              content: 'Pesanan tiba dalam 2 sampai 4 hari kerja.',
            },
            { value: 'retur', title: 'Bagaimana cara retur?', content: retur },
          ]"
          defaultValue="pengiriman"
        />
      `,
    })
    export class Faq {}

    content menerima teks biasa atau referensi ng-template untuk isi kaya.

    • type="single" (default) memberi atribut name yang sama ke setiap details, sehingga browser menutup bagian lain secara native. Pakai type="multiple" agar beberapa bagian bisa terbuka bersamaan.
    • Browser lama yang belum mendukung details[name] tetap bisa membuka bagian, hanya tidak eksklusif.
    • Komponen ini tidak punya teks bawaan. Judul dan isi berasal dari data Anda sendiri, jadi cukup tulis dalam Bahasa Indonesia.

    Props

    NamaTipeDefaultKeterangan
    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 }[][]Daftar bagian. Di Blade dan Vue, isi tiap bagian lewat slot dengan nama sama seperti key/value. Astro memakai slot bernama yang sama bila item tidak punya content. Svelte menerima snippet dan Angular referensi ng-template untuk isi kaya.
    type'single' | 'multiple''single'single: hanya satu bagian terbuka (atribut name yang sama di details). multiple: bebas.
    defaultValuestring | string[]-Bagian yang terbuka saat pertama dirender. Pada type single hanya nilai pertama yang dipakai.

    Aksesibilitas

    • Memakai details dan summary native, jadi summary berperan sebagai tombol dengan status terbuka atau tertutup.
    • Enter dan Spasi pada summary membuka dan menutup bagian.
    • Ikon chevron diberi aria-hidden.

    Komponen terkait

    Komponen navigasi lain dengan class yang sama di setiap framework.