Skip to content

Commit 393c440

Browse files
Apply suggestions from code review
Co-authored-by: Cole Bemis <[email protected]>
1 parent 38ffda3 commit 393c440

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

docs/content/Tooltip.mdx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Tooltip
44
status: Alpha
55
source: https://github.com/primer/react/tree/main/src/Tooltip
66
storybook: '/react/storybook?path=/story/composite-components-tooltip'
7-
description: The Tooltip component adds a tooltip to add context to elements on the page.
7+
description: Use tooltips to add context to elements on the page.
88
---
99

1010
Tooltip only appears on mouse hover or keyboard focus and contain a label or description text. Use tooltips sparingly and as a last resort. [Consider these alternatives](https://primer.style/design/accessibility/tooltip-alternatives).
@@ -30,7 +30,7 @@ import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code
3030
</Tooltip>
3131
</Box>
3232

33-
When using a tooltip, follow the provided guidelines to avoid accessibility issues.
33+
When using a tooltip, follow the provided guidelines to avoid accessibility issues:
3434

3535
- Tooltip text should be brief and to the point.
3636
- Tooltips should contain only **non-essential text**. Tooltips can easily be missed and are not accessible on touch devices so never use tooltips to convey critical information.
@@ -71,13 +71,13 @@ Set direction of tooltip with `direction`. The tooltip is responsive and will au
7171
>
7272
<Box sx={{display: 'flex', justifyContent: 'space-between', gap: 1}}>
7373
<Tooltip direction="nw" text="Tooltip text">
74-
<Button>North West</Button>
74+
<Button>North west</Button>
7575
</Tooltip>
7676
<Tooltip direction="n" text="Tooltip text">
7777
<Button>North</Button>
7878
</Tooltip>
7979
<Tooltip direction="ne" text="Tooltip text">
80-
<Button>North East</Button>
80+
<Button>North east</Button>
8181
</Tooltip>
8282
</Box>
8383
<Box sx={{display: 'flex', justifyContent: 'space-between', gap: 1}}>
@@ -90,20 +90,22 @@ Set direction of tooltip with `direction`. The tooltip is responsive and will au
9090
</Box>
9191
<Box sx={{display: 'flex', justifyContent: 'space-between', gap: 1}}>
9292
<Tooltip direction="sw" text="Tooltip text">
93-
<Button>South West</Button>
93+
<Button>South west</Button>
9494
</Tooltip>
9595
<Tooltip direction="s" text="Tooltip text">
9696
<Button>South</Button>
9797
</Tooltip>
9898
<Tooltip direction="se" text="Tooltip text">
99-
<Button>South East</Button>
99+
<Button>South east</Button>
100100
</Tooltip>
101101
</Box>
102102
</Box>
103103
```
104104

105105
## Props
106106

107+
### Tooltip
108+
107109
<PropsTable>
108110
<PropsTableRow name="children" required type="React.ReactNode" description="Tooltip target, single element" />
109111

@@ -124,8 +126,8 @@ Set direction of tooltip with `direction`. The tooltip is responsive and will au
124126
/>
125127
<PropsTableRow
126128
name="type"
127-
type="description | label"
128-
defaultValue="description"
129+
type="'description' | 'label'"
130+
defaultValue="'description'"
129131
description={
130132
<>
131133
Use <InlineCode>aria-describedby</InlineCode> or <InlineCode>aria-labelledby</InlineCode>
@@ -134,11 +136,11 @@ Set direction of tooltip with `direction`. The tooltip is responsive and will au
134136
/>
135137
<PropsTableRow
136138
name="direction"
137-
type="nw | n | ne | e | se | s | sw | w"
138-
defaultValue="n"
139+
type="'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w'"
140+
defaultValue="'n'"
139141
description="Sets where the tooltip renders in relation to the target"
140142
/>
141-
<PropsTableRow name="align" deprecated type="left | right" description="Use direction instead. Alignment relative to target" />
143+
<PropsTableRow name="align" deprecated type="'left' | 'right'" description="Use direction instead. Alignment relative to target" />
142144
<PropsTableRow
143145
name="noDelay"
144146
type="boolean"

0 commit comments

Comments
 (0)