-
Notifications
You must be signed in to change notification settings - Fork 381
Expand file tree
/
Copy pathDragButton.tsx
More file actions
38 lines (36 loc) · 1.3 KB
/
DragButton.tsx
File metadata and controls
38 lines (36 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { css } from '@patternfly/react-styles';
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list';
import RhUiGripVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-grip-vertical-fill-icon';
export interface DragButtonProps extends Omit<React.HTMLProps<HTMLButtonElement>, 'size'> {
/** Additional classes added to the drag button */
className?: string;
/** Sets button type */
type?: 'button' | 'submit' | 'reset';
/** Flag indicating if drag is disabled for the item */
isDisabled?: boolean;
/** Accessible name of the drag button. */
'aria-label'?: string;
/** Id or list of id's that label the drag button. */
'aria-labelledby'?: string;
}
export const DragButton: React.FunctionComponent<DragButtonProps> = ({
className,
'aria-label': ariaLabel = 'Drag button',
'aria-labelledby': ariaLabelledby,
...props
}: DragButtonProps) => (
<Button
variant="plain"
className={css(className)}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledby}
icon={
<span className={css(dragButtonStyles.dataListItemDraggableIcon)}>
<RhUiGripVerticalFillIcon />
</span>
}
{...props}
/>
);
DragButton.displayName = 'DragButton';