Overview
ElementOptions is a compound component for building inline configuration popovers attached to elements. It provides form controls (Select, Toggle, Slider, ColorPicker, Input) and helper hooks for updating element properties.

Features
- Compound components — Root, Trigger, Content, Group, Label, Separator
- Form controls — Select, Toggle, Slider, ColorPicker, Input
- Helper hooks —
useElementOptions,useUpdateElementProps - Radix UI — Built on Radix Popover for accessibility and positioning
Installation
Basic Usage
API Reference
ElementOptions.Root
Root component that provides context and manages popover state.
| Prop | Type | Description |
|---|---|---|
blockId | string | Block ID containing element |
element | SlateElement | The element being configured |
children | ReactNode | Trigger and Content |
className | string | Custom CSS classes |
style | CSSProperties | Custom inline styles |
ElementOptions.Trigger
Button that opens the options popover.
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Custom icon (defaults to MoreHorizontal) |
className | string | Custom CSS classes |
style | CSSProperties | Custom inline styles |
ElementOptions.Content
Floating content panel containing form controls.
| Prop | Type | Default | Description |
|---|---|---|---|
side | 'top' | 'right' | 'bottom' | 'left' | 'bottom' | Placement side |
align | 'start' | 'center' | 'end' | 'end' | Alignment |
sideOffset | number | 4 | Offset from trigger |
alignOffset | number | 0 | Alignment offset |
className | string | Custom CSS classes |
ElementOptions.Group
Groups related controls together.
ElementOptions.Label
Label for a group of controls.
ElementOptions.Separator
Visual separator between groups.
ElementOptions.Select
Dropdown select for choosing from predefined options.
| Prop | Type | Description |
|---|---|---|
value | T | Current selected value |
options | SelectOption<T>[] | Available options |
onValueChange | (value: T) => void | Called when selection changes |
placeholder | string | Placeholder text |
renderOption | (option: SelectOption<T>) => ReactNode | Custom option renderer |
renderValue | (option?: SelectOption<T>) => ReactNode | Custom value renderer |
ElementOptions.Toggle
Boolean toggle switch.
| Prop | Type | Description |
|---|---|---|
checked | boolean | Current state |
onCheckedChange | (checked: boolean) => void | Called when toggled |
label | string | Optional label text |
ElementOptions.Slider
Numeric slider for range values.
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | Current value | |
onValueChange | (value: number) => void | Called on change | |
min | number | 0 | Minimum value |
max | number | 100 | Maximum value |
step | number | 1 | Step increment |
ElementOptions.ColorPicker
Color picker with presets and hex input.
| Prop | Type | Description |
|---|---|---|
value | string | Current color (hex) |
onChange | (color: string) => void | Called on change |
presetColors | string[] | Preset color swatches |
ElementOptions.Input
Text input for string values.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | Current value | |
onChange | (value: string) => void | Called on change | |
placeholder | string | Placeholder text | |
type | 'text' | 'number' | 'url' | 'text' | Input type |
Hooks
useElementOptions()
Access element context within Content.
| Property | Type | Description |
|---|---|---|
blockId | string | Block ID |
element | SlateElement | Current element |
editor | YooEditor | Editor instance |
isOpen | boolean | Popover open state |
setIsOpen | (open: boolean) => void | Toggle popover |
useUpdateElementProps<T>()
Helper hook for updating element properties.
Examples
Callout Theme Selector
Divider with Style and Color
Table Appearance Toggles
Table of Contents with Input and Toggles
Styling
CSS Variables
Custom Styling
Apply Tailwind or custom classes to components:Best Practices
Separate options into their own component
Separate options into their own component
Use group-hover for trigger visibility
Use group-hover for trigger visibility
Provide default values
Provide default values

