feat(controls): add orientation, style and class props closes #4069

This commit is contained in:
moklick
2024-04-04 12:53:05 +02:00
parent 56477f058d
commit 508efab624
8 changed files with 36 additions and 4 deletions
@@ -34,6 +34,7 @@ function ControlsComponent({
className,
children,
position = 'bottom-left',
orientation = 'vertical',
'aria-label': ariaLabel = 'React Flow controls',
}: ControlProps) {
const store = useStoreApi();
@@ -65,9 +66,11 @@ function ControlsComponent({
onInteractiveChange?.(!isInteractive);
};
const orientationClass = orientation === 'horizontal' ? 'horizontal' : 'vertical';
return (
<Panel
className={cc(['react-flow__controls', className])}
className={cc(['react-flow__controls', orientationClass, className])}
position={position}
style={style}
data-testid="rf__controls"
@@ -31,6 +31,7 @@ export type ControlProps = {
/** ClassName applied to container */
className?: string;
'aria-label'?: string;
orientation?: 'horizontal' | 'vertical';
};
export type ControlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;