Dialog.
A focused space for important decisions.
Live preview
import { Dialog, Button, TextField } from "luminescent";
import "luminescent/style.css";
export function Example() {
return (
<Dialog
trigger={<Button>Edit profile</Button>}
title="Edit profile"
description="Make changes to your workspace identity."
>
<TextField label="Display name" defaultValue="Alex Morgan" />
</Dialog>
);
}
Installation
npm install luminescent
Import luminescent/style.css once at your application root. The example above uses the same package implementation as Storybook.
Variants and states
Use the preview controls to explore the supported variants, sizes, disabled/loading states and reduced motion. Controls appear only where the component exposes the corresponding prop. Theme and glow apply to every component.
Controlled and uncontrolled state
State contract: open / defaultOpen / onOpenChange. Omit the controlled prop to let the component own its initial state; supply a value and callback when your application owns it. Native uncontrolled fields and state-backed form controls participate in form reset. Controlled state must be reset by the application.
import { useState } from "react";
import { Dialog, Button } from "luminescent";
export function ControlledExample() {
const [value, setValue] = useState(false);
return (
<Dialog
title="Edit profile"
open={value}
onOpenChange={setValue}
trigger={<Button>Edit profile</Button>}
>
Your project details.
</Dialog>
);
}
API reference
Generated from the source TypeScript interfaces. Native attributes, className, style, aria-* and data-* also pass through to the documented element. Import DialogProps from the package for the full inherited contract.
| Prop | Type | Details |
|---|---|---|
trigger | React.ReactElement | Optional unless marked required. |
titlerequired | React.ReactNode | Optional unless marked required. |
description | React.ReactNode | Optional unless marked required. |
open | boolean | Optional unless marked required. |
defaultOpen | boolean | Optional unless marked required. |
onOpenChange | (open: boolean) => void | Optional unless marked required. |
closeLabel | string | Optional unless marked required. |
size | 'sm' | 'md' | 'lg' | Optional unless marked required. |
Accessibility and keyboard
Radix modal: traps Tab focus, makes background inert, closes on Escape/outside interaction and restores trigger focus. A required title names the dialog; description is optional. Supply a ref-forwarding trigger. Open programmatically only after a user action.
Keep labels meaningful and test application-level contrast, focus order and screen-reader output. See the accessibility guide for composition requirements.
Theme customization
import { LuminescentProvider, Dialog, Button, TextField } from "luminescent";
import "luminescent/style.css";
export function Example() {
return (
<LuminescentProvider theme="light" accent="violet" glow="subtle">
<Dialog
trigger={<Button>Edit profile</Button>}
title="Edit profile"
description="Make changes to your workspace identity."
>
<TextField label="Display name" defaultValue="Alex Morgan" />
</Dialog>
</LuminescentProvider>
);
}
Switch between light and dark in the preview, or open the playground for a larger workspace. Custom CSS variables can override spacing, color, typography and effects.