Skip to content

Commit 9387249

Browse files
committed
docs: add focus-trap
1 parent caf7304 commit 9387249

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
},
1616
{
17-
"files": "*.md",
17+
"files": ["*.md", "*.mdx"],
1818
"options": {
1919
"printWidth": 100,
2020
"proseWrap": "always"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
id: focus-trap
3+
title: Focus Trap
4+
description: Trap focus within a specified container.
5+
status: new
6+
---
7+
8+
## Motivation
9+
10+
Focus trapping is essential for modal interfaces and other interactive elements that require user
11+
attention.
12+
13+
The `FocusTrap` component helps maintain accessibility by ensuring keyboard focus remains within a
14+
designated container until explicitly released.
15+
16+
## Examples
17+
18+
<Example id="basic" />
19+
20+
### Autofocus
21+
22+
The focus trap respects elements with the `autofocus` attribute.
23+
24+
<Example id="autofocus" />
25+
26+
### Initial Focus
27+
28+
Use the `initialFocus` prop to set the element that should receive initial focus when the trap is
29+
activated.
30+
31+
<Example id="initial-focus" />
32+
33+
## API Reference
34+
35+
<ComponentTypes id="focus-trap" />

0 commit comments

Comments
 (0)