Sections
Components
- AlertBanner
- AlertDialog
- Alert
- Avatar
- Badge
- Breadcrumb
- Button
- CalendarIcon
- CellLayout
- CellLink
- Checkbox
- Collapse
- ContentSwitcher
- ControlLabel
- DatePicker
- Dialog
- Divider
- Drawer
- EmptyCell
- EmptyState
- Empty
- ErrorOverlay
- FilterBar
- FilterChips
- Flex
- GridLayout
- HumanisedDate
- Icon
- InputDuration
- InputField
- Input
- Label
- Loader
- MoreActions
- NumberInput
- OutsideClickHandler
- PageLoader
- Page
- Popconfirm
- Popover
- ProgressPie
- Progress
- RadioButtonGroup
- RadioGroup
- Radio
- RelativeTime
- Resizable
- SearchInput
- Select
- SkeletonText
- Skeleton
- Space
- SquadAvatarList
- StatusPicker
- Stepper
- Switch
- TableLight
- Tabs
- Tag
- Text
- Textarea
- Toast
- Tooltip
- TriggerSelect
- Upload
import { OutsideClickHandler, Button } from "@/rl-ui";
<OutsideClickHandler onOutsideClick={() => setOpen(false)}>
<Button>Inside</Button>
</OutsideClickHandler>Examples#
Panel content#
Wrap popover-like UI; outside clicks typically close the panel.
import { OutsideClickHandler, Text, Button, Space } from "@/rl-ui";
<OutsideClickHandler
className="rounded-8 border border-border p-4"
onOutsideClick={() => setOpen(false)}
>
<Space direction="vertical" size="small">
<Text variant="heading-03">Filters</Text>
<Text variant="body-short-01">Click outside this panel to dismiss.</Text>
<Button variant="primary" size="small">Apply</Button>
</Space>
</OutsideClickHandler>Disabled listener#
import { OutsideClickHandler, Button } from "@/rl-ui";
<OutsideClickHandler disabled onOutsideClick={() => {}}>
<Button variant="secondary">Outside clicks ignored</Button>
</OutsideClickHandler>Inline display#
import { OutsideClickHandler, Badge } from "@/rl-ui";
<OutsideClickHandler display="inline-flex" onOutsideClick={() => {}}>
<Badge color="blue">Inline wrapper</Badge>
</OutsideClickHandler>API#
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Wrapped tree (required). |
onOutsideClick | (event: MouseEvent) => void | — | Fires when click starts and ends outside. |
allowed | (target: HTMLElement) => boolean | — | Treat matching targets as inside (skip handler). |
disabled | boolean | false | Disable listening. |
useCapture | boolean | false | Use capture phase for listeners. |
display | CSSProperties["display"] | — | CSS display on the wrapper. |
className | string | — | Wrapper className. |
style | CSSProperties | — | Inline styles on the wrapper. |