GitHubGitHub
← All components
Overlays / component

Modal

A focus-trapped modal with Escape, backdrop dismissal, focus restoration, sizes, and footer composition.

SmallMediumLargeKeyboard
<Modal open title="Confirm change" onclose={close}>...</Modal>

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Modal } from '@chanrg/4ui';<Modal open title="Confirm change" onclose={close}>...</Modal>

API reference

Props

PropTypeDefaultDescription
openbooleanfalseDialog visibility.
sizesm | md | lgmdMaximum width.
onclose() => voidClose request callback.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Traps focus, restores the prior target, and closes with Escape.

Dependencies

No runtime component dependencies.