Skip to main content

Component Anatomy

Temper follows compound component patterns to provide fine-grained control over layout, styling, and behavior.

import { Drawer } from '@ughur/temper';

<Drawer.Root>
<Drawer.Trigger />
<Drawer.Portal>
<Drawer.Overlay />
<Drawer.Content>
<Drawer.Handle />
<Drawer.Title />
<Drawer.Description />
<Drawer.Close />
</Drawer.Content>
</Drawer.Portal>
</Drawer.Root>

Component Roles

ComponentRequiredDescription
Drawer.RootYesManages open state, gesture tracking, snap points, and physics calculations.
Drawer.TriggerYesInteractive element (button) that toggles the drawer open.
Drawer.PortalYesRenders overlay and content into document body portal to avoid parent clipping/z-index issues.
Drawer.OverlayYesBackdrop overlay covering the page content behind the drawer.
Drawer.ContentYesMain visible drawer container that handles drag gestures and position fixed locking.
Drawer.HandleOptionalVisual drag handle bar with built-in touch target area (44x44px hit target).
Drawer.TitleYes (A11y)Accessible title element announced by screen readers when opened.
Drawer.DescriptionOptionalAccessible description element providing supplementary context to screen readers.
Drawer.CloseOptionalAction trigger button to close the active drawer.
Drawer.NestedRootOptionalRoot component for drawers rendered inside an active drawer stack.

Compound Export

The components are exported as standard named sub-properties on the default Drawer object or individually if needed:

import { Drawer, Root, Content, Trigger } from '@ughur/temper';