A contextual action menu for pointer and keyboard users.
import { ContextMenu } from '@vrum/ui';
import { ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator } from '@vrum/ui';
<ContextMenu>
<ContextMenuTrigger><div style={{ padding: 40, border: "1px dashed #d4d4d4" }}>Right-click or press Shift+F10</div></ContextMenuTrigger><ContextMenuContent><ContextMenuItem>Rename</ContextMenuItem><ContextMenuItem>Duplicate</ContextMenuItem><ContextMenuSeparator /><ContextMenuItem>Archive</ContextMenuItem></ContextMenuContent>
</ContextMenu>Copy code| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | none | Content rendered inside the component. |
open | boolean | none | Controlled visibility. |
onOpenChange | ((open: boolean) => void) | none | Called when visibility changes. |
dir | Direction | none | dir configuration. |
modal | boolean | none | modal configuration. |
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | none | Disable user interaction. |
asChild | boolean | none | as child configuration. |
defaultChecked | boolean | none | default checked configuration. |
defaultValue | string | number | readonly string[] | none | Initial value for an uncontrolled component. |
autoFocus | boolean | none | auto focus configuration. |
className | string | none | Additional CSS classes. |
id | string | none | id configuration. |
style | CSSProperties | none | Inline style overrides. |
aria-invalid | boolean | "false" | "true" | "grammar" | "spelling" | none | Indicates the entered value does not conform to the format expected by the application. |
aria-label | string | none | Defines a string value that labels the current element. |
children | ReactNode | none | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLSpanElement> | none | on focus configuration. |
onBlur | FocusEventHandler<HTMLSpanElement> | none | on blur configuration. |
onChange | ChangeEventHandler<HTMLSpanElement, Element> | none | Called when the input value changes. |
onSubmit | SubmitEventHandler<HTMLSpanElement> | none | Called when the form is submitted. |
onKeyDown | KeyboardEventHandler<HTMLSpanElement> | none | on key down configuration. |
onClick | MouseEventHandler<HTMLSpanElement> | none | Called when the control is activated. |
onSelect | ReactEventHandler<HTMLSpanElement> | none | on select configuration. |
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | none | as child configuration. |
defaultChecked | boolean | none | default checked configuration. |
defaultValue | string | number | readonly string[] | none | Initial value for an uncontrolled component. |
autoFocus | boolean | none | auto focus configuration. |
className | string | none | Additional CSS classes. |
id | string | none | id configuration. |
style | CSSProperties | none | Inline style overrides. |
aria-invalid | boolean | "false" | "true" | "grammar" | "spelling" | none | Indicates the entered value does not conform to the format expected by the application. |
aria-label | string | none | Defines a string value that labels the current element. |
children | ReactNode | none | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLDivElement> | none | on focus configuration. |
onBlur | FocusEventHandler<HTMLDivElement> | none | on blur configuration. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | none | Called when the input value changes. |
onSubmit | SubmitEventHandler<HTMLDivElement> | none | Called when the form is submitted. |
onKeyDown | KeyboardEventHandler<HTMLDivElement> | none | on key down configuration. |
onClick | MouseEventHandler<HTMLDivElement> | none | Called when the control is activated. |
onSelect | ReactEventHandler<HTMLDivElement> | none | on select configuration. |
loop | boolean | none | Whether keyboard navigation should loop around |
forceMount | true | none | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. |
alignOffset | number | none | align offset configuration. |
arrowPadding | number | none | arrow padding configuration. |
avoidCollisions | boolean | none | avoid collisions configuration. |
collisionBoundary | Boundary | Boundary[] | none | collision boundary configuration. |
collisionPadding | number | Partial<Record<"top" | "bottom" | "left" | "right", number>> | none | collision padding configuration. |
sticky | Sticky | none | sticky configuration. |
hideWhenDetached | boolean | none | hide when detached configuration. |
updatePositionStrategy | UpdatePositionStrategy | none | update position strategy configuration. |
onCloseAutoFocus | ((event: Event) => void) | none | Event handler called when auto-focusing on close. Can be prevented. |
onEscapeKeyDown | ((event: KeyboardEvent) => void) | none | on escape key down configuration. |
onPointerDownOutside | ((event: PointerDownOutsideEvent) => void) | none | on pointer down outside configuration. |
onFocusOutside | ((event: FocusOutsideEvent) => void) | none | on focus outside configuration. |
onInteractOutside | ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | none | on interact outside configuration. |
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | none | as child configuration. |
disabled | boolean | none | Disable user interaction. |
defaultChecked | boolean | none | default checked configuration. |
defaultValue | string | number | readonly string[] | none | Initial value for an uncontrolled component. |
autoFocus | boolean | none | auto focus configuration. |
className | string | none | Additional CSS classes. |
id | string | none | id configuration. |
style | CSSProperties | none | Inline style overrides. |
aria-invalid | boolean | "false" | "true" | "grammar" | "spelling" | none | Indicates the entered value does not conform to the format expected by the application. |
aria-label | string | none | Defines a string value that labels the current element. |
children | ReactNode | none | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLDivElement> | none | on focus configuration. |
onBlur | FocusEventHandler<HTMLDivElement> | none | on blur configuration. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | none | Called when the input value changes. |
onSubmit | SubmitEventHandler<HTMLDivElement> | none | Called when the form is submitted. |
onKeyDown | KeyboardEventHandler<HTMLDivElement> | none | on key down configuration. |
onClick | MouseEventHandler<HTMLDivElement> | none | Called when the control is activated. |
onSelect | ((event: Event) => void) | none | on select configuration. |
textValue | string | none | text value configuration. |
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | none | as child configuration. |
defaultChecked | boolean | none | default checked configuration. |
defaultValue | string | number | readonly string[] | none | Initial value for an uncontrolled component. |
autoFocus | boolean | none | auto focus configuration. |
className | string | none | Additional CSS classes. |
id | string | none | id configuration. |
style | CSSProperties | none | Inline style overrides. |
aria-invalid | boolean | "false" | "true" | "grammar" | "spelling" | none | Indicates the entered value does not conform to the format expected by the application. |
aria-label | string | none | Defines a string value that labels the current element. |
children | ReactNode | none | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLDivElement> | none | on focus configuration. |
onBlur | FocusEventHandler<HTMLDivElement> | none | on blur configuration. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | none | Called when the input value changes. |
onSubmit | SubmitEventHandler<HTMLDivElement> | none | Called when the form is submitted. |
onKeyDown | KeyboardEventHandler<HTMLDivElement> | none | on key down configuration. |
onClick | MouseEventHandler<HTMLDivElement> | none | Called when the control is activated. |
onSelect | ReactEventHandler<HTMLDivElement> | none | on select configuration. |