Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abaabil.details

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaabil.details

  • 0.1.6
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

Details Component

The Details component is used to create expandable sections in your application. It's part of the abaabil.details library.

Installation

npm install abaabil.details

Importing

You can import the Details component from the abaabil.details package:

import Details from 'abaabil.details';

Basic Usage

The Details component can be used in your JSX to create expandable sections. You can customize the component by setting its properties such as summary, icon, openIcon, closeIcon, and more.

<Details summary="Click to expand" icon="info-circle">
  This is the content inside the Details component.
</Details>

Examples

Basic Example

<div className="space-y-4">
  <Details summary="Apple Details Summary Text" icon="apple">
    <div>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit.
    </div>
  </Details>
  <Details summary="Banana Details Summary Text" icon="cherry">
    This is the content inside the Details component.
  </Details>
</div>

Custom Icons

You can customize the icons used in the Details component:

<Details 
  summary="Custom Icons Example" 
  icon="info-circle"
  openIcon="chevron-up"
  closeIcon="chevron-down"
>
  This Details component has custom icons.
</Details>

Initially Expanded

You can set the Details component to be initially expanded:

<Details summary="Initially Expanded" expanded={true}>
  This Details component is initially expanded.
</Details>

Properties

PropertyTypeDescriptionDefaultRequired
summaryReactNodeContent to display in the summary (header)-Yes
childrenReactNodeContent to display when expanded-Yes
iconstringIcon ID to display next to the summary-No
openIconstringIcon ID to display when open'chevron-down'No
closeIconstringIcon ID to display when closed'chevron-up'No
classNamestringAdditional CSS classes-No
expandedbooleanWhether initially expandedfalseNo

The Details component also supports all other default properties available to the HTML details element.

Accessibility

The Details component is designed with accessibility in mind:

  • Uses proper ARIA attributes for the summary and content.
  • Supports full keyboard navigation:
    • Enter and Space: Toggle open/close
    • Arrow Up and Left: Close the details
    • Arrow Down and Right: Open the details
  • Manages its own open/closed state.
  • Properly labels summary and content for screen readers.

Styling

The Details component comes with some default styling, but you can customize its appearance using the className prop and your own CSS.

Notes

  • The component uses React hooks internally, so it requires React 16.8+.
  • Icons are rendered using a separate Icon component from abaabil.temp.icon. Ensure this dependency is available in your project.

For more information or to report issues, please visit the abaabil.details GitHub repository.

Keywords

FAQs

Package last updated on 23 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc