Vertical
Default downward disclosure. Starts open here so the layout is visible; click the title to toggle.
Vertical details
variant="vertical" open
WelkUI!REACT EDITIONExplore live variants, compare states, and learn every prop. Pick a component to start.
A native details/summary disclosure for progressively revealing content. Click or use the keyboard on its title to toggle it. Set the native open prop to start expanded; nest accordions inside the content to build hierarchies.
import { WelkAccordion } from "@welkui/react";
<WelkAccordion title="The details">A little more to discover.</WelkAccordion>Import @welkui/react/styles.css once in your app. Stateful snippets belong inside a React component.
These are real components, not screenshots. Compare their appearance and try the controls. Key props below each preview show what changes; use the usage example above for imports and component setup.
Default downward disclosure. Starts open here so the layout is visible; click the title to toggle.
variant="vertical" openReveals content beside its title rather than below.
variant="horizontal" openPlace a nested disclosure inside a parent to build a content hierarchy.
variant="nested"Expand the summary, then click elsewhere on the page to close it.
closeOnOutsideClick fixedWidth={320}Required props are marked in the default column. Other props are optional. ReactNode accepts text or JSX.
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | Required | Interactive disclosure heading. |
children | ReactNode | Unset | Content revealed when expanded. |
variant | "vertical" | "horizontal" | "nested" | "vertical" | Disclosure layout and appearance. |
closeOnOutsideClick | boolean | false | Closes the disclosure when clicking outside it. |
fixedWidth | CSSProperties["width"] | Unset | Fixed disclosure width, such as 320 or 20rem. |
open | boolean | Native default: false | Native details open state. |
onToggle | ReactEventHandler<HTMLDetailsElement> | Unset | Native disclosure toggle notification. |
Inherits native details props except title, including name, className, style, aria-* and data-*; forwards a details ref.
Import @welkui/react/styles.css once in your app entry or Next.js root layout. The previews use the default theme; override --welk-* CSS tokens in your app to customize it.
For Next.js, put hooks and event handlers in a component beginning with "use client". Keep state local to the component using the control. The library preserves its client boundaries and uses your installed React version.
Use defaultValue or defaultChecked for uncontrolled fields, or a state value and its change callback for controlled fields. Do not switch between these modes during the lifetime of a field.
Modal and notification examples start closed: use their Try buttons to see them. Disabled examples are deliberately non-interactive. Validate forms, uploads, authentication, and server responses in your application; these components only provide UI.