VaneUI

VaneUI

Overlay Components

Overlay

A fullscreen backdrop overlay for creating modal backgrounds, loading screens, and lightbox effects. Renders via portal with click-to-close and optional blur.

Basic Overlay

A fullscreen semi-transparent backdrop. Click the overlay to close it.

react-icon
const [open, setOpen] = useState(false);
<Button onClick={() => setOpen(true)}>Show Overlay</Button>
<Overlay open={open} onClose={() => setOpen(false)}>
<Text>Click anywhere to close</Text>
</Overlay>

Overlay with Content

Place content inside the overlay. Use e.stopPropagation() on inner elements to prevent closing when clicking them.

react-icon
<Overlay open={open} onClose={() => setOpen(false)}>
<Card onClick={(e) => e.stopPropagation()}>
<Text>Overlay content here</Text>
</Card>
</Overlay>

Blur Effect

Add blur for a backdrop-filter blur effect behind the overlay.

react-icon
<Overlay open={open} onClose={() => setOpen(false)} blur>
<Text>Blurred Background</Text>
</Overlay>

Non-dismissible Overlay

Use pointerEventsNone for loading states where the overlay should not be closable by clicking.

react-icon
<Overlay open={open} pointerEventsNone>
<Text>Loading...</Text>
</Overlay>

Transparent Overlay

Use the transparent prop to create an invisible overlay that still captures clicks. This is useful for click-away dismissal without visually dimming the page background.

react-icon
const [open, setOpen] = useState(false);
<Button onClick={() => setOpen(true)}>Show Transparent Overlay</Button>
<Overlay open={open} onClose={() => setOpen(false)} transparent>
<Card>
<Text>Content on a transparent overlay</Text>
<Button onClick={() => setOpen(false)}>Close</Button>
</Card>
</Overlay>

Custom Animation Duration

Control how the overlay transitions in and out. Use transitionDuration to set a custom duration in milliseconds (default is 200ms), or use noAnimation to disable transitions entirely for an instant open/close.

react-icon
{/* Slow fade — 500ms */}
<Overlay open={open} onClose={onClose} transitionDuration={500}>
<Card>Slow transition content</Card>
</Overlay>
{/* Instant — no animation */}
<Overlay open={open} onClose={onClose} noAnimation>
<Card>Instant content</Card>
</Overlay>

Overlay Props

Size

Size props for controlling component dimensions

xs

Extra small size

sm

Small size

md

Medium size (default)

lg

Large size

xl

Extra large size

Hide

Hide props for responsive element visibility

mobileHide

Hide element on mobile devices and below (max-mobile: 48rem)

tabletHide

Hide element on tablet devices and below (max-tablet: 64rem)

desktopHide

Hide element on desktop devices and below (max-desktop: 80rem)

Items

Items props for controlling flex item alignment (align-items)

itemsStart

Align items to start (top/left)

itemsEnd

Align items to end (bottom/right)

itemsCenter

Align items to center

itemsBaseline

Align items to baseline

itemsStretch

Stretch items to fill container

Justify

Justify props for controlling flex content alignment (justify-content)

justifyStart

Pack items toward the start of the main axis

justifyEnd

Pack items toward the end of the main axis

justifyCenter

Center items along the main axis

justifyBetween

Distribute items with space between them

justifyAround

Distribute items with space around them

justifyEvenly

Distribute items with equal space around them

justifyStretch

Stretch items to fill the main axis

justifyBaseline

Align items along their baseline on main axis

Position

Position props for controlling CSS position property

relative

Relative positioning

absolute

Absolute positioning

fixed

Fixed positioning

sticky

Sticky positioning

static

Static positioning

Display

Display props for controlling CSS display property

inline

Inline display - flows with text

block

Block display - takes full width, new line

inlineBlock

Inline-block display - inline but with block properties

flex

Flex display - flexbox container

inlineFlex

Inline-flex display - inline flexbox container

grid

Grid display - CSS grid container

inlineGrid

Inline-grid display - inline grid container

contents

Contents display - element's box is removed, children display as if parent didn't exist

table

Table display - behaves like table element

tableCell

Table-cell display - behaves like td element

hidden

Hidden display - element is not visible

Overflow

Overflow props for controlling content overflow behavior

overflowAuto

Auto overflow - show scrollbars if needed

overflowHidden

Hidden overflow - clip content without scrollbars

overflowClip

Clip overflow - hard clip without scrollbars

overflowVisible

Visible overflow - content extends beyond bounds

overflowScroll

Scroll overflow - always show scrollbars

overflowXAuto

Auto overflow on X-axis only

overflowYAuto

Auto overflow on Y-axis only

overflowXHidden

Hidden overflow on X-axis only

overflowYHidden

Hidden overflow on Y-axis only

overflowXClip

Clip overflow on X-axis only

overflowYClip

Clip overflow on Y-axis only

overflowXVisible

Visible overflow on X-axis only

overflowYVisible

Visible overflow on Y-axis only

overflowXScroll

Scroll overflow on X-axis only

overflowYScroll

Scroll overflow on Y-axis only

Appearance

Appearance props for controlling component colors

primary

Primary color appearance (gray)

brand

Brand color appearance (blue)

accent

Accent color appearance (rose)

secondary

Secondary color appearance (gray)

tertiary

Tertiary color appearance

success

Success color appearance (green)

danger

Danger color appearance (red)

warning

Warning color appearance (amber)

info

Info color appearance (cyan)

link

Link color appearance (blue, for hyperlinks)

inherit

Inherit appearance from parent — suppresses own data-appearance/data-variant, uses parent's CSS variables

Shadow

Shadow props for controlling drop shadows

shadow

Enable drop shadow

noShadow

Disable drop shadow

Ring

Ring props for controlling focus rings

ring

Enable focus ring

noRing

Disable focus ring

Variant

Variant props for controlling component style variations

filled

Filled variant - solid background with contrasting text color

outline

Outline variant - transparent background with border and colored text (default)

Blur

Blur props for controlling backdrop blur effect

blur

Enable backdrop blur effect

noBlur

Disable backdrop blur effect

Pointer Events

Pointer events props for controlling element interactivity

pointerEventsNone

Disable pointer events - clicks pass through the element

pointerEventsAuto

Enable pointer events (default browser behavior)

Width

Width props for controlling component width

wFull

Set width to 100%

wFit

Set width to fit-content

wAuto

Set width to auto

wScreen

Set width to 100vw (viewport width), removes max-width constraint

Height

Height props for controlling component height

hFit

Set height to fit-content

hFull

Set height to 100%

hAuto

Set height to auto

hScreen

Set height to 100vh (viewport height), removes max-height constraint

Transparent

Transparent prop for disabling background color

transparent

Disable background color - makes component background transparent

Responsive

Responsive prop for enabling breakpoint-specific sizing

responsive

Enable responsive sizing - uses breakpoint-specific classes for font size, padding, and gap