A single section that opens and closes, built on native details and summary without JavaScript. Good for show more content.
Show order details
Show order details
Show order details
Show order details
Show order details
<x-markas.collapsible title="Show order details">
Shipped from Jakarta on 4 November with standard delivery. Tracking number JKT-2210-884.
</x-markas.collapsible>import { Collapsible } from "@/components/markas/Collapsible";
export default function CollapsibleExample() {
return (
<Collapsible title="Show order details">
Shipped from Jakarta on 4 November with standard delivery. Tracking number
JKT-2210-884.
</Collapsible>
);
}<script setup lang="ts">
import Collapsible from "@/components/markas/Collapsible.vue";
</script>
<template>
<Collapsible title="Show order details">
Shipped from Jakarta on 4 November with standard delivery. Tracking number
JKT-2210-884.
</Collapsible>
</template><script lang="ts">
import Collapsible from "$lib/components/markas/Collapsible.svelte";
</script>
<Collapsible title="Show order details">
Shipped from Jakarta on 4 November with standard delivery. Tracking number
JKT-2210-884.
</Collapsible>---
import Collapsible from "@/components/markas/Collapsible.astro";
---
<Collapsible title="Show order details">
Shipped from Jakarta on 4 November with standard delivery. Tracking number
JKT-2210-884.
</Collapsible>Examples
Open by default
Release notes
Release notes
Release notes
Release notes
Release notes
<x-markas.collapsible title="Release notes" open>
Faster search, a new export to PDF, and fixes for date filters in reports.
</x-markas.collapsible>import { Collapsible } from "@/components/markas/Collapsible";
export default function Example() {
return (
<Collapsible title="Release notes" open>
Faster search, a new export to PDF, and fixes for date filters in reports.
</Collapsible>
);
}<script setup lang="ts">
import Collapsible from "@/components/markas/Collapsible.vue";
</script>
<template>
<Collapsible title="Release notes" open>
Faster search, a new export to PDF, and fixes for date filters in reports.
</Collapsible>
</template><script lang="ts">
import Collapsible from "$lib/components/markas/Collapsible.svelte";
</script>
<Collapsible title="Release notes" open>
Faster search, a new export to PDF, and fixes for date filters in reports.
</Collapsible>---
import Collapsible from "@/components/markas/Collapsible.astro";
---
<Collapsible title="Release notes" open>
Faster search, a new export to PDF, and fixes for date filters in reports.
</Collapsible>Show more
Team members
- Rina Kusuma
- Budi Santoso
- Dewi Lestari
Show 3 more
- Agus Pratama
- Sari Wulandari
- Yusuf Hidayat
Team members
- Rina Kusuma
- Budi Santoso
- Dewi Lestari
Show 3 more
- Agus Pratama
- Sari Wulandari
- Yusuf Hidayat
Team members
- Rina Kusuma
- Budi Santoso
- Dewi Lestari
Show 3 more
- Agus Pratama
- Sari Wulandari
- Yusuf Hidayat
Team members
- Rina Kusuma
- Budi Santoso
- Dewi Lestari
Show 3 more
- Agus Pratama
- Sari Wulandari
- Yusuf Hidayat
Team members
- Rina Kusuma
- Budi Santoso
- Dewi Lestari
Show 3 more
- Agus Pratama
- Sari Wulandari
- Yusuf Hidayat
In a card
Invoice INV-0412
Paid on 2 November, total Rp 1.250.000
Payment breakdown
Invoice INV-0412
Paid on 2 November, total Rp 1.250.000
Payment breakdown
Invoice INV-0412
Paid on 2 November, total Rp 1.250.000
Payment breakdown
Invoice INV-0412
Paid on 2 November, total Rp 1.250.000
Payment breakdown
Invoice INV-0412
Paid on 2 November, total Rp 1.250.000
Payment breakdown
<div class="grid gap-3 rounded-xl border border-line bg-surface p-4">
<div class="grid gap-1">
<p class="text-sm font-medium text-ink">Invoice INV-0412</p>
<p class="text-sm text-muted">Paid on 2 November, total Rp 1.250.000</p>
</div>
<x-markas.collapsible title="Payment breakdown" class="border-t border-line pt-2">
Subtotal Rp 1.126.000, tax Rp 124.000, paid with bank transfer.
</x-markas.collapsible>
</div>Installation
npx markasui@latest add collapsiblepnpm dlx markasui@latest add collapsibleyarn dlx markasui@latest add collapsiblebunx --bun markasui@latest add collapsible- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
resources/views/components/markas/collapsible.blade.php.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Collapsible.tsx.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Collapsible.vue.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/Collapsible.svelte.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Collapsible.astro.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/collapsible.component.ts.
Usage
<x-markas.collapsible title="Show order details">
Shipped from Jakarta on 4 November. Tracking number JKT-2210-884.
</x-markas.collapsible>No Alpine.js needed. Use the title slot for rich content: <x-slot:title>Show <strong>3.
import { Collapsible } from "@/components/markas/Collapsible";
<Collapsible title="Show order details" open>
Shipped from Jakarta on 4 November. Tracking number JKT-2210-884.
</Collapsible>;<template>
<Collapsible title="Show order details">
Shipped from Jakarta on 4 November. Tracking number JKT-2210-884.
</Collapsible>
</template><script lang="ts">
import Collapsible from "$lib/components/markas/Collapsible.svelte";
let open = $state(false);
</script>
<Collapsible title="Show order details" bind:open>
Shipped from Jakarta on 4 November. Tracking number JKT-2210-884.
</Collapsible>For rich content pass a snippet instead of a string: {#snippet title()}Show <strong>3.
---
import Collapsible from "@/components/markas/Collapsible.astro";
---
<Collapsible title="Show order details">
Shipped from Jakarta on 4 November. Tracking number JKT-2210-884.
</Collapsible>No JavaScript is shipped. Use the title slot for rich content: <Fragment slot="title">Show <strong>3.
import { Component } from "@angular/core";
import { Collapsible } from "./markas/collapsible.component";
@Component({
selector: "app-order",
imports: [Collapsible],
template: `
<details markas-collapsible title="Show order details">
Shipped from Jakarta on 4 November. Tracking number JKT-2210-884.
</details>
`,
})
export class Order {}The component sits on the native details, so open, class, and (toggle) work directly. For rich content add <ng-container title>Show <strong>3.
- Built on
detailsandsummary, so it works without JavaScript and the browser handles keyboard and screen reader state. openonly sets the starting state. Listen to the nativetoggleevent to react to changes.- For several related sections where only one should be open, use Accordion instead.
Props
| Name | Type | Default | Description |
|---|---|---|---|
title | string / slot / ReactNode / snippet | - | Text of the summary row. Blade, Vue, and Astro also accept a title slot, Svelte a title snippet, and Angular an element with the title attribute (an ng-container works) for rich content. |
open | boolean | false | Starts the section open. Svelte supports bind:open. |
children / slot | ReactNode / slot | - | Content shown when the section is open. |
Accessibility
- Uses native details and summary, so the summary is a focusable disclosure button announced as expanded or collapsed.
- Enter and Space toggle the section; no JavaScript is needed.
- The chevron icon is decorative and hidden from assistive technology.
Related components
More navigation components with the same classes in every framework.
- AccordionCollapsible sections built on native details and summary, no JavaScript needed.
- BreadcrumbTrail of the current page's location in the site hierarchy, with the current page marked by aria-current.
- FooterSite footer with six layouts: link columns, centered glow, newsletter pill card, giant cropped wordmark, dark glowing call to action, and a floating pill.
- MenubarHorizontal bar of menus like a desktop app, built on the Popover API, with keyboard support following the WAI-ARIA Menubar pattern.
- NavbarSite header with a brand, links, dropdown menus, a sliding hover pill, an actions area, and a mobile menu with collapsible groups.
- Navigation MenuDesktop site navigation with mega menu panels on the Popover API, a sliding active indicator, hover intent, and WAI-ARIA disclosure keyboard support.