Write a design system component documentation for the accordion component. describe…
- User
Write a design system component documentation for the accordion component. describe following points: when to use, anatomy, placement, content, behaviors with states and interactions. Add 3 links for best practices of this component.
- Assistant
When to use: The accordion component is used when a user needs to view and hide content in a limited space. It is useful for displaying a large amount of content in a organized and manageable way.
Anatomy:
- Header: The header of the accordion component is used to label the content that will be displayed when the accordion is expanded.
- Content: The content of the accordion component is the information that is displayed when the accordion is expanded.
- Expansion indicator: The expansion indicator is used to show the user whether the accordion is expanded or collapsed.
Placement: The accordion component should be placed in a clear and visible location on the page, near related content.
Content: The content of the accordion component should be relevant and useful to the user. It should be organized and easy to read.
Behaviors with states and interactions:
- Collapsed state: The accordion component is in a collapsed state when it is first loaded. The user can expand the accordion by clicking on the header.
- User
continue
- Assistant
Additional Best practices: 4. Use clear and descriptive labels for the accordion headers to help users understand the content they will find when expanding the accordion.
- Use the accordion to group related content together, and consider organizing the content in a logical order.
- Limit the number of items in the accordion to keep the content manageable for the user.
- Use a clear visual indicator to show the expanded or collapsed state of the accordion.
- Allow the user to expand or collapse multiple accordions at once if it makes sense for the content and user experience.
- Consider using the accordion in conjunction with other navigation or filtering options to make it easy for users to find the information they need.
- Test the accordion component with users to ensure it meets their needs and is easy to use.
- User
Add a table with the interactive states (default, hover, active, focus, disabled) of the component and describe: element, state, property and color token.
- Assistant
Interactive States Table:
Element State Property Color Token Header Default Background #f5f5f5 Hover Background #e5e5e5 Active Background #d5d5d5 Focus Border #4d90fe Disabled Background #e5e5e5 Text color #a9a9a9 Content Default Background #f5f5f5 Hover Background #e5e5e5 Active Background #d5d5d5 Focus Border #4d90fe Disabled Background #e5e5e5 - User
Add a text about the best practices for accessibility for this component.
- Assistant
Accessibility is an important aspect to consider when designing and implementing an accordion component. Some best practices for ensuring accessibility for the accordion component include:
- Use clear and descriptive labels for the accordion headers to help users understand the content they will find when expanding the accordion.
- Provide a way for keyboard-only users to expand and collapse the accordion. This can be done by adding a keyboard event listener on the header element that expands or collapses the accordion when the enter or space key is pressed.
- Use ARIA attributes to indicate the state of the accordion to assistive technologies. This can include adding an "aria-expanded" attribute to the header element, which indicates whether the accordion is expanded or collapsed.
- Use ARIA attributes to provide a clear hierarchy to assistive technologies. This can include adding an "aria-label" attribute to the accordion component and "aria-labelledby" attribute to the content element.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.