Disclosure
Una sección que se abre y se cierra: detalles que casi nadie necesita.
import { Disclosure, DisclosureSkeleton } from '@sypnia/ui/react'
Ajustes avanzados
Cerrada hasta que alguien la pide.
Código
import { Disclosure, Field, FormGrid, NumberInput } from '@sypnia/ui/react';
// Details most people do not need stay closed until someone asks for them.
export default function Advanced() {
return (
<Disclosure title="Advanced settings">
<FormGrid>
<Field label="Time limit (seconds)"><NumberInput defaultValue={30} min={1} /></Field>
<Field label="Retries"><NumberInput defaultValue={3} min={0} /></Field>
</FormGrid>
</Disclosure>
);
} En Astro
El gemelo para páginas estáticas, sobre un details nativo.
How the price is worked out
Each product has its own plans. Capacity you add is paid with credits, and you see what each credit was spent on.
Código
---
// The Astro twin, for static pages: a native <details>, so it opens with no JavaScript.
import Disclosure from '@sypnia/ui/astro/Disclosure.astro';
---
<Disclosure title="How the price is worked out">
<p>Each product has its own plans. Capacity you add is paid with credits, and you see what each credit was spent on.</p>
</Disclosure> Skeleton
La pieza real y su skeleton: la misma caja, así nada se mueve cuando llegan los datos.
Código
import { Disclosure, DisclosureSkeleton } from '@sypnia/ui/react';
export default function Skeleton() {
return (
<div className="sy-stack">
<Disclosure title="Why was this payment refused?">The bank said the card has no funds.</Disclosure>
<DisclosureSkeleton />
</div>
);
} Cuándo usarlo
Úsalo cuando
- Ajustes avanzados, una explicación, un detalle largo.
No lo uses cuando
- Tiene algo que todos necesitan: muéstralo.
- Varias seguidas: Accordion.
Para todos
- El título es un botón que dice si está abierto.
- El gemelo de Astro (
@sypnia/ui/astro/Disclosure.astro) es undetailsnativo: Enter o Espacio lo abren sin JavaScript, y buscar en la página lo abre cuando el texto está adentro.
Props
| Disclosure | Tipo | Por defecto |
|---|---|---|
titleobligatorio | ReactNode | |
defaultOpen | boolean |