Skip to content

Nebula Modal

A controlled dialog with a soft coloured backdrop.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import { useState } from "react";
import NebulaModal from "./NebulaModal";
export default function Example() {
const [open, setOpen] = useState(false);
return (
<>
<button onClick={() => setOpen(true)}>Open modal</button>
<NebulaModal
title={"Make room for something great."}
subtitle={"Ready for your next chapter?"}
body={"Bring your ideas together in one space. You can change these settings at any time."}
primaryLabel={"Continue"}
secondaryLabel={"Cancel"}
colors={[
"#101218",
"#7c83ff",
"#b5f5d1"
]}
intensity={0.9}
minHeight={280}
open={open}
onClose={() => setOpen(false)}
onPrimaryClick={() => setOpen(false)}
/>
</>
);
}

Using Nebula Modal

Control visibility with open and close the dialog in response to onClose. Supply a meaningful title and the content through body or children.

Wire primary and secondary actions to their matching callbacks. Use closeLabel to describe the dismiss control in the language of your interface.

Props

NameTypeRequiredDefaultDescription
openbooleanNofalseWhether the dialog is open. Control this state in your application.
onClosefunctionNoundefinedCalled on Escape, backdrop click, or the close button. Set open to false.
titlestringNo""Main title text shown at the top of the modal card.
subtitlestringNo""Optional supporting line shown just under the title, useful for a short explanation or tagline.
bodystringNo""Body copy inside the modal. In real usage this would often hold a short paragraph describing the action or message.
childrenReactNodeNoundefinedYour content. No demo content is rendered by default.
primaryLabelstringNo""Primary action label. Use an empty string to hide the action.
secondaryLabelstringNo""Label for the secondary action button, useful for cancel or dismiss actions.
onPrimaryClickfunctionNoundefinedCalled when the primary action is pressed; receives current values for forms.
onSecondaryClickfunctionNoundefinedCalled when the secondary action is pressed; receives current values for forms.
colorsstring[]No["#101218", "#7c83ff", "#b5f5d1"]Array of up to three hex colors used to paint the nebula glow behind the modal card.
intensitynumberNo.9Overall brightness and strength of the nebula glow. Lower values keep the effect more subtle.
minHeightnumber | stringNo260Minimum height for the modal container. Accepts a number (pixels) or any valid CSS height string.
closeLabelstringNo"Close dialog"Accessible label for the dialog close button.
classNamestringNo""Additional CSS class names, merged with base component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

Slide Drawer

Overlays

A full-height side panel slides over a softened backdrop with native modal focus.

Peek Popover

Overlays

A compact disclosure opens into a softly hinged floating surface.

A searchable command menu with grouped actions and keyboard navigation.