Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Primitives
  2. Interactable
  3. API and Development

Interactable

API and Development

View Source
Submit Issue

Interactable is used to add keyboard accessibility and interactive behavior to any element, making non-interactive elements like divs function as accessible buttons. It provides a versatile wrapper that transforms any element into a keyboard-accessible, interactive component. Built using Radix UI's Slot component, it enables proper button semantics and keyboard interactions without requiring changes to the underlying element structure.

Props

NameDefaultDescription
interactionTypeInteractableType.DefaultEnum for interaction styling variants. Other variations of InteractableType include Default | Primary | Secondary.
activefalseWhether the interactable is in an active/selected state.
disabledfalseWhether the interactable is disabled and cannot be interacted with.
tabIndex0 when enabled, -1 when disabledOverrides the default tab order. Pass -1 for composite widgets that keep focus elsewhere (for example aria-activedescendant lists).
injectChildfalseWhether to inject interactivity into a child element (using Radix UI Slot) instead of wrapping in a button.
classNameAdditional CSS classes to apply to the element.
onClickCallback function called when the element is clicked or activated via keyboard.
onMouseEnterCallback function called when the mouse enters the element.
onMouseLeaveCallback function called when the mouse leaves the element.
onMouseDownCallback function called when mouse button is pressed down.
onMouseUpCallback function called when mouse button is released.
onMouseMoveCallback function called when mouse moves over the element.
onKeyDownCallback function called when a key is pressed.
onKeyUpCallback function called when a key is released.
onDragEnterCallback function called when a dragged element enters the drop zone.
onDragLeaveCallback function called when a dragged element leaves the drop zone.
onDragOverCallback function called when a dragged element is over the drop zone.
onDropCallback function called when a dragged element is dropped.
onDragStartCallback function called when dragging starts.
onDragEndCallback function called when dragging ends.
hrefURL to navigate to when the element is clicked (converts to link behavior).
childrenrequiredThe content to make interactive.

Interactive card

With Interaction Types

Use interaction types to apply different styling effects.

Default

Primary

Secondary

Complex Layouts

Complex Layouts

Use to make entire complex layouts interactive as a single unit.

As Navigation Links

Use with href to create link-like behavior.

With Hover Effects

Combine with mouse event handlers for rich interactions.

With Drag and Drop

Use drag event handlers to create draggable or droppable elements.

In Data Tables

Use to create interactive table rows or cells.

With Custom Styling

Add custom classes for specific visual treatments.

Nested Interactive Elements

Handle nested interactive elements carefully to avoid conflicts.

With Keyboard Shortcuts

Combine with keyboard event handlers for enhanced interactions.

With Inject Child

With Inject Child

Use injectChild to inject interactivity directly into the child element using Radix UI's Slot, maintaining the child's element type while adding interactive behavior.

Interactive Cards

Use to create clickable card components with proper accessibility.

Interactive List Items

Use to create interactive list items that respond to clicks and keyboard navigation.

With Active State

Use to indicate the currently selected or active element.

Disabled State

Use to prevent interaction while maintaining visual presence.

Previous

Interactable / Usage

Next

Accessibility / Keyboard Support

On this page

Props
Interactive card
With Interaction Types
Default
Primary
Secondary
Complex Layouts
Complex Layouts
As Navigation Links
With Hover Effects
With Drag and Drop
In Data Tables
With Custom Styling
Nested Interactive Elements
With Keyboard Shortcuts
With Inject Child
With Inject Child
Interactive Cards
Interactive List Items
With Active State
Disabled State