logoRuru UI

Modal

The Modal component is used to display content in a modal dialog.

Installation

npx ruru-ui-cli@latest add modal

Usage

Here is an example of how to use the Modal component.

Example

The Modal component can be used with a custom trigger button.

Single button

The Modal component can be used with a single button.

Disabled actions

The Modal component can be used with disabled actions.

The Modal component can be used with a custom width.

Preview Component

The component that you see on preview

Props

Here's how the props table would look for the Modal component, formatted in the same style:

Props

NameTypeDefaultDescription
childrenReactNodeundefinedThe children of the Modal component.
onClickOutside() => voidundefinedThe function to call when the user clicks outside the modal.

ModalAction

NameTypeDefaultDescription
fullWidthbooleanfalseDetermines if the action button should take the full width.
onClick() => void | Promise<void>undefinedThe function to call when the user clicks the action.

Trigger

NameTypeDefaultDescription
childrenReactNodeundefinedThe children of the Modal component.
onClick() => voidundefinedThe function to call when the user clicks the trigger.
asChildbooleanfalseRender as a child component.

DivProps

NameTypeDefaultDescription
classNamestring""Additional class names for the container.
childrenReactNodeundefinedThe children of the component.

PTagProps

NameTypeDefaultDescription
classNamestring""Additional class names for the paragraph element.
childrenReactNodeundefinedThe children of the paragraph element.

On this page