Skip to content

Commit

Permalink
Tweak docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Aug 20, 2024
1 parent 8a6f204 commit a6676a5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/data/base/components/collapsible/collapsible.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import * as Collapsible from '@base_ui/react/Collapsible';

:::warning
This is [not yet supported](https://caniuse.com/mdn-html_global_attributes_hidden_until-found_value) in Safari and Firefox as of August 2024 and will fall back to the default `hidden` behavior.

Check warning on line 63 in docs/data/base/components/collapsible/collapsible.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/data/base/components/collapsible/collapsible.md", "range": {"start": {"line": 63, "column": 146}}}, "severity": "WARNING"}

:::

Content hidden in the `Collapsible.Content` component can be made accessible only to a browser's find-in-page functionality with the `htmlHidden` prop to improve searchability:
Expand All @@ -75,6 +76,8 @@ Content hidden in the `Collapsible.Content` component can be made accessible onl
</Collapsible.Root>
```
We recommend using [CSS animations](#css-animations) for animated collapsibles that use this feature. Currently there is browser bug that does not highlight the found text inside elements that have a [CSS transition](#css-transitions) applied.

Check warning on line 79 in docs/data/base/components/collapsible/collapsible.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'We'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "docs/data/base/components/collapsible/collapsible.md", "range": {"start": {"line": 79, "column": 1}}}, "severity": "WARNING"}
This relies on the HTML `hidden="until-found"` attribute which only has [partial browser support](https://caniuse.com/mdn-html_global_attributes_hidden_until-found_value) as of August 2024, but automatically falls back to the default `hidden` state in unsupported browsers.
## Animations
Expand Down Expand Up @@ -127,6 +130,12 @@ CSS animations can be used with two declarations:
### CSS Transitions
When using CSS transitions, styles for the `Content` subcomponent must be applied to three states:
- The closed styles with `[data-state="closed"]`
- The open styles with `[data-state="open"]`
- The entering styles with `[data-entering]`
```css
.Collapsible-content {
overflow: hidden;
Expand Down Expand Up @@ -186,3 +195,17 @@ function App() {
);
}
```
## Overriding default components
Use the `render` prop to override the rendered elements with your own components.
```jsx
// Element shorthand
<Collapsible.Content render={<MyCollapsibleContent />} />
```
```jsx
// Function
<Collapsible.Content render={(props) => <MyCollapsibleContent {...props} />} />
```

0 comments on commit a6676a5

Please sign in to comment.