Clevision

Accordion

Component 8

About

Here is Accordion component

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Accordion to your project and fits it to your theme.

Code

How Accordion is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'

const items = [
  {
    name: 'Richard Payne',
    email: '[email protected]',
    avatarImage: 'https://cdn.21st.dev/assets/mirror/03/03a7fd80e48b0c266374a64bc634dbbb85582fd0dd77c1a27ecff4bb5406ff81.png',
    content:
      'Richard Payne is a remarkable individual known for his exceptional skills and expertise in various fields. With a strong background in technology and a passion for innovation, Richard has made significant contributions to the industry.'
  },
  {
    name: 'Jordan Stevenson',
    email: '[email protected]',
    avatarImage: 'https://cdn.21st.dev/assets/mirror/ae/ae6a92c60e520aa6a3fe089f29762926b8851effbc1d39107437dae04aa88ae3.png',
    content:
      'Jordan Stevenson is a talented individual with a passion for technology and innovation. Jordan has made significant contributions to various projects and has a deep understanding of programming languages and frameworks.'
  },
  {
    name: 'Nicholas Tanner',
    email: '[email protected]',
    avatarImage: 'https://cdn.21st.dev/assets/mirror/2f/2fcafa6e39ea7272850e186aa5d39db75cba438a6a1194b908bc5a1385dd41bf.png',
    content:
      'Nicholas Tanner is a highly skilled individual with a strong passion for technology and innovation. Nicholas has made significant contributions to numerous projects and possesses a deep understanding of various programming languages and frameworks.'
  }
]

const AccordionAvatarDemo = () => {
  return (
    <Accordion type='single' collapsible className='w-full' defaultValue='item-1'>
      {items.map((item, index) => (
        <AccordionItem key={index} value={`item-${index + 1}`}>
          <AccordionTrigger className='items-center hover:no-underline'>
            <span className='flex items-center gap-4'>
              <Avatar className='size-10.5 rounded-sm'>
                <AvatarImage src={item.avatarImage} alt={item.name} className='rounded-sm' />
                <AvatarFallback className='rounded-sm text-xs'>
                  {item.name.split(/\s/).reduce((response, word) => (response += word.slice(0, 1)), '')}
                </AvatarFallback>
              </Avatar>
              <span className='flex flex-col space-y-0.5'>
                <span>{item.name}</span>
                <span className='text-muted-foreground font-normal'>{item.email}</span>
              </span>
            </span>
          </AccordionTrigger>
          <AccordionContent className='text-muted-foreground'>{item.content}</AccordionContent>
        </AccordionItem>
      ))}
    </Accordion>
  )
}

export default AccordionAvatarDemo

More by Clevision

View all
  • Calendar

    Calendar

    107
  • Card Studio

    Card Studio

    101
  • Collapsible

    Collapsible

    43
  • Button Group

    Button Group

    38
  • Buttons

    Buttons

    33
  • Radio Group 1

    Radio Group 1

    30
  • Combobox

    Combobox

    27
  • Basic Avatar

    Basic Avatar

    26