Import
import { DragHandle } from '@contentful/f36-components';// orimport { DragHandle } from '@contentful/f36-drag-handle';
Examples
The DragHandle can be styled based on the props you pass to it:
Base:
Active:
Focused:
Hovered:
Card example
Props (API reference)
Open in StorybookName | Type | Default |
---|---|---|
label required | string Label rendered in DragHandle - not visible on screen as its purpose is for screen readers only | |
className | string CSS class to be appended to the root element | |
css | string number false true ComponentSelector Keyframes SerializedStyles ArrayInterpolation<undefined> ObjectInterpolation<undefined> (theme: any) => Interpolation<undefined> | |
isActive | false true Applies styling for when the component is actively being dragged by the user | |
isFocused | false true Applies focus styling | |
isHovered | false true Applies hover styling | |
testId | string A [data-test-id] attribute used for testing purposes | cf-ui-drag-handle |
type | string Set type button for div element |
Accessibility
- You should pass a relevant label to DragHandle for screen readers, the label is not rendered.