Accordion
glasswave/accordionFreeComponent
A vertically stacked set of interactive headings that each reveal a section of content.
Live preview
live · rendered by the registry
Rendered by glasswave on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://glasswave.denizisik.com/r/accordion.jsonSource
1"use client";23import * as AccordionPrimitive from "@radix-ui/react-accordion";4import { ChevronDown } from "lucide-react";5import { forwardRef } from "react";6import { cn } from "@/lib/utils";7import { focusRing, glass } from "@/lib/glass";89const Accordion = AccordionPrimitive.Root;1011const AccordionItem = forwardRef<12 React.ElementRef<typeof AccordionPrimitive.Item>,13 React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>14>(({ className, ...props }, ref) => (15 <AccordionPrimitive.Item16 ref={ref}17 className={cn(18 glass,19 "mb-2.5 transition-colors last:mb-0",20 "hover:bg-black/[0.025] dark:hover:bg-white/[0.05]",21 className,22 )}23 {...props}24 />25));26AccordionItem.displayName = "AccordionItem";2728const AccordionTrigger = forwardRef<29 React.ElementRef<typeof AccordionPrimitive.Trigger>,30 React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>31>(({ className, children, ...props }, ref) => (32 <AccordionPrimitive.Header className="flex">33 <AccordionPrimitive.Trigger34 ref={ref}35 className={cn(36 "group flex flex-1 items-center justify-between gap-4 px-5 py-4 text-left text-sm font-medium [&[data-state=open]>svg]:rotate-180",37 focusRing,38 className,39 )}40 {...props}41 >42 {children}43 <ChevronDown className="size-4 shrink-0 text-current/50 transition-transform duration-200" />44 </AccordionPrimitive.Trigger>45 </AccordionPrimitive.Header>46));47AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;4849const AccordionContent = forwardRef<50 React.ElementRef<typeof AccordionPrimitive.Content>,51 React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>52>(({ className, children, ...props }, ref) => (53 <AccordionPrimitive.Content54 ref={ref}55 className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"56 {...props}57 >58 <div className={cn("px-5 pb-4 text-current/70", className)}>{children}</div>59 </AccordionPrimitive.Content>60));61AccordionContent.displayName = AccordionPrimitive.Content.displayName;6263export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
What it pulls in
npm packages
Other registry items
Files it writes
More from glasswave
All 60 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | glasswave | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | glasswave | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | glasswave | Components | Free | 1 dep | |
| Avataravatar | glasswave | Components | Free | 1 dep | |
| Badgebadge | glasswave | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | glasswave | Components | Free | 2 deps | |
| Buttonbutton | glasswave | Components | Free | 2 deps | |
| Button Groupbutton-group | glasswave | Components | Free | 1 dep |
