Ir al contenido

co-bottom-sheet

Sheet inferior móvil con física de gestos nativa: sigue el dedo 1:1 hacia abajo, un flick rápido (o soltar pasado ~45% de su altura) lo cierra, el overdrag hacia arriba hace rubber-band y el backdrop se acopla al arrastre. La altura se ajusta al contenido con tope max-height (default 85dvh).

El cuerpo scrollea internamente: arrastrar desde el contenido solo mueve el sheet cuando el scroll está arriba del todo; el handle y el header siempre arrastran. Con dismissible="false" el gesto resiste en ambas direcciones y el cierre queda solo en backdrop/Escape.

Contenido del sheet…
Ver código
<co-bottom-sheet heading="Configuración" open>
<div style="padding: 4px 20px 20px">Contenido del sheet…</div>
<div slot="footer" style="display:flex; gap:8px">
  <co-button variant="stroke" label="Cancelar" style="flex:1"></co-button>
  <co-button variant="primary" label="Guardar" style="flex:1"></co-button>
</div>
</co-bottom-sheet>

Props

PropAtributoTipoDefaultDescripción
closeOnEscapeclose-on-escapebooleantrueClose when pressing Escape
closeOnOverlayclose-on-overlaybooleantrueClose when tapping the backdrop
dismissibledismissiblebooleantrueAllow closing with the drag gesture. When false, drags rubber-band back.
headingheadingstring''Sheet title (used when the `header` slot is empty)
maxHeightmax-heightstring'85dvh'Maximum sheet height (any CSS length; content shorter than this hugs)
openopenbooleanfalseWhether the sheet is visible
showHandleshow-handlebooleantrueShow the grab handle

Eventos

EventoDetailBubblesCancelableDescripción
coAfterClosevoidSlide-out animation finished.
coAfterOpenvoidSlide-in animation finished.
coClosevoidRequested to close (gesture, backdrop, Esc). Consumer should set `open=false`.
coOpenvoidTransitioned to open=true.

Slots

SlotDescripción
(default)Sheet body (scrollable).
footerPinned action area below the body (outside the scroll), with safe-area padding.
headerCustom header content (overrides `heading`). Dragging it moves the sheet.

CSS Parts

PartDescripción
::part(backdrop)
::part(body)
::part(footer)
::part(handle)
::part(header)
::part(sheet)

CSS Custom Properties

Este componente no expone CSS custom properties.