Skip to content

Commit 2e9501b

Browse files
committed
docs: update FocusRing
There's now a props section, containing the new `type` prop that was implemented in commit e1ca355. A demo showing the difference between the two types has also been added in the usage section.
1 parent e1ca355 commit 2e9501b

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

apps/docs/content/components/focus-ring.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ title: Focus Ring
55
## Usage
66

77
<usage></usage>
8+
9+
## Props
10+
| Name | Type | Description | Default |
11+
| --------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------- | --------- |
12+
| type | `outward` `inward` | The way the focus ring is animated and positioned. | `outward` |
13+
| as | `keyof HTMLElementTagNameMap` `React.ElementType` | Allows for more flexibility when supporting different elements that can act as a FocusRing. | `span` |
14+
| style | `React.CSSProperties` |||
15+
| className | `string` |||
Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
import { FocusRing, useFocusRing } from 'actify'
2+
import React from 'react'
23

3-
export default () => {
4+
function FocusRingInput({ inward }: {inward?: boolean}) {
45
const { isFocused, focusProps } = useFocusRing()
6+
57
return (
68
<span className="relative">
7-
<input {...focusProps} className="outline-none text-primary" />
8-
{isFocused && <FocusRing />}
9+
<input {...focusProps} className="outline-none text-primary"/>
10+
{isFocused && <FocusRing type={inward ? 'inward' : 'outward'} />}
911
</span>
12+
);
13+
}
14+
15+
export default () => {
16+
return (
17+
<div className="flex items-center gap-4">
18+
<div className='relative mb-2'>
19+
<h6>type outward</h6>
20+
<FocusRingInput />
21+
</div>
22+
<div className='relative mb-2'>
23+
<h6>type inward</h6>
24+
<FocusRingInput inward />
25+
</div>
26+
</div>
1027
)
1128
}

0 commit comments

Comments
 (0)