HextaUI

Accordion: Right to left

Content, icons and the open motion follow the reading direction.

مجموعة مكونات مبنية على shadcn/ui مع اهتمام بالتفاصيل والحركة.

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion"

const items = [
  {
    value: "what",
    question: "ما هي HextaUI؟",
    answer: "مجموعة مكونات مبنية على shadcn/ui مع اهتمام بالتفاصيل والحركة.",
  },
  {
    value: "install",
    question: "كيف أثبّت مكوّنًا؟",
    answer: "انسخ الشيفرة إلى مشروعك وعدّلها كأي ملف تملكه.",
  },
  {
    value: "license",
    question: "هل يمكنني استخدامها في مشاريع تجارية؟",
    answer: "نعم، جميع المكونات مجانية ومفتوحة المصدر.",
  },
]

export function AccordionRtl() {
  return (
    <div dir="rtl" className="w-full max-w-md">
      <Accordion variant="outline" defaultValue={["what"]}>
        {items.map((item) => (
          <AccordionItem key={item.value} value={item.value}>
            <AccordionTrigger>{item.question}</AccordionTrigger>
            <AccordionContent>{item.answer}</AccordionContent>
          </AccordionItem>
        ))}
      </Accordion>
    </div>
  )
}

This adds the example as components/examples/accordion/rtl.tsx, together with the Accordion component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/accordion-rtl.json

To add only the component, follow the Accordion installation.

Props in this example

The Accordion props this example sets, from the API reference.

PropTypeDefault
variant
"default" | "outline" | "separated" | "ghost""default"
defaultValue
Value[]–
PropTypeDefault
valueGenerated automatically when omitted.
Value–

Every prop is in the Accordion API reference.

See them all, with keyboard support and accessibility notes, on the Accordion page.