7.0.2 • Published 1 year ago

@leafygreen-ui/interaction-ring v7.0.2

Weekly downloads
437
License
Apache-2.0
Repository
github
Last release
1 year ago

Interaction Ring

npm (scoped)

Installation

Yarn

yarn add @leafygreen-ui/interaction-ring

NPM

npm install @leafygreen-ui/interaction-ring

Example

import InteractionRing from '@leafygreen-ui/interaction-ring';

// When the child is the focused element
<InteractionRing>
  <button>Click me</button>
</InteractionRing>;

// When the focused element is not the child
const [inputElement, setInputElement] = React.useState(null);

<InteractionRing focusTargetElement={inputElement}>
  <div className="Div appearing as button">
    Click me
    <input className="Visually hidden input" ref={setInputElement} />
  </div>
</InteractionRing>;

Output HTML

<div class="leafygreen-ui-1wkamvn">
  <div class="leafygreen-ui-pppkef Div appearing as button">
    Click me<input class="Visually hidden input" />
  </div>
  <div data-leafygreen-ui="interaction-ring" class="leafygreen-ui-ebg95b"></div>
</div>

Properties

PropTypeDescriptionDefault
darkModebooleanWhether to display the component in dark mode.false
classNamestringAdds a className to the container children and the interaction ring. See the following props for ways to customize the interaction ring.
borderRadiusstringSpecify the border radius of the interaction ring. The string format is that which can be passed directly to a border-radius CSS property.'4px'
color{ hovered?: boolean, focused?: boolean }Override the interaction ring color for the specified states.
childrenReact.ReactElementA single React child that the interaction ring should surround visually.
focusTargetElementHTMLElementThe element for which to watch focus events.The element rendered by the provided children prop
disabledbooleanWhether to disable the interaction ring.false
forceState{ hovered?: boolean, focused?: boolean }Force the specified interaction ring states to be displayed.
7.0.0

1 year ago

7.0.2

1 year ago

7.0.1

1 year ago

5.0.0

2 years ago

6.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

4.0.2-test.0

2 years ago

4.0.1

2 years ago

4.0.2-next.1

2 years ago

4.0.2-next.0

2 years ago

4.0.2-next.2

2 years ago

4.0.0

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago