Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

CollapsibleSection

Sección plegable ya armada, con título, ícono o número, badge y acciones en el encabezado.

Seguir leyendo — 3 párrafos más

Collapsible section with chevron animation, optional icon/number and badge.

Supports controlled mode (isOpen + onToggle) and uncontrolled mode (defaultOpen).

Uses CSS variables for theming:

  • --ui-border for section border
  • --ui-bg-raised for background
  • --ui-content-primary for title text
  • --ui-content-secondary for icon and chevron
  • --ui-accent for default badge
  • --ui-warning, --ui-success, --ui-info, --ui-content-muted for semantic badges

161 sitios de import en 9 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.

  • EasyYachts
  • TheCharterPanel
  • cmp-packages
  • dietaly
  • easycharter
  • elliot
  • gestorsalon
  • luigi
  • prepchat

El componente, montado

Cargando el espécimen…

Cómo se usa

import { CollapsibleSection } from '@solu30/ui-kit/input'

Props

19 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
titlesístringSection title
subtitleopcionalstringSecondary text after title
iconopcionalReactNodeOptional icon to display before the title
numberopcionalnumberNumbered circle that replaces icon
badgeopcionalstring | CollapsibleBadgeOptional badge — string for accent pill, object for semantic colors
defaultOpenopcionalbooleanWhether the section is open by default (uncontrolled mode)
isOpenopcionalbooleanControlled open state — if provided, component is controlled
onToggleopcional() => voidCallback when toggle is clicked (required for controlled mode)
allowOverflowopcionalbooleanAllow content to overflow (useful for dropdowns inside)
disableCollapseopcionalbooleanDisable collapsing — always open, no chevron
forceOpenopcionalbooleanImperative open via useEffect
actionsopcionalReactNodeRight-side interactive slot (before chevron)
mobileActionsInContentopcionalbooleanMove actions to content area on mobile screens
rightInfoopcionalReactNodeRight-side read-only info
compactopcionalbooleanSmaller padding and font
childrensíReactNodeSection content
classNameopcionalstringAdditional CSS class for the wrapper
headerClassNameopcionalstringAdditional CSS class for the header row
contentClassNameopcionalstringAdditional CSS class for the content wrapper

Ejemplo del paquete

// Uncontrolled
<CollapsibleSection title="Advanced Options" defaultOpen>
  <p>Content here</p>
</CollapsibleSection>

// Controlled
<CollapsibleSection title="Filters" isOpen={open} onToggle={() => setOpen(!open)}>
  <FilterForm />
</CollapsibleSection>

// With semantic badge
<CollapsibleSection title="Alerts" badge={{ type: 'warning', text: '3 issues' }}>
  <AlertList />
</CollapsibleSection>

// Numbered, compact, with actions
<CollapsibleSection title="Step 1" number={1} compact actions={<Button size="sm">Edit</Button>}>
  <StepForm />
</CollapsibleSection>

Del @example del JSDoc de @solu30/ui-kit, sin editar: son 65 de los 541 símbolos. La sangría y los renglones en blanco son los del paquete.