Skip to content

Commit

Permalink
Rearrange render prop sections
Browse files Browse the repository at this point in the history
  • Loading branch information
colmtuite committed May 2, 2024
1 parent 94fe6fb commit 1129343
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
20 changes: 10 additions & 10 deletions docs/data/base/components/checkbox/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ Checkbox is composed of two components.
</Checkbox.Root>
```

## Overriding default components

Use the `render` prop to override the rendered checkbox or indicator element with your own components.

```jsx
<Checkbox.Root render={(props) => <MyCheckbox {...props} />}>
<Checkbox.Indicator render={(props) => <MyCheckboxIndicator {...props} />} />
</Checkbox.Root>
```

## Indeterminate state

To make the checkbox indeterminate, add the `indeterminate` prop to override the appearance of the checkbox. The checkbox remains in an indeterminate state regardless of user interaction until set back to `false`.
Expand All @@ -78,6 +68,16 @@ The primary use case for an indeterminate checkbox is representing the state of

It's a _visual-only_ state, so its internal `checked` state can still be changed.

## Overriding default components

Use the `render` prop to override the rendered checkbox or indicator element with your own components.

```jsx
<Checkbox.Root render={(props) => <MyCheckbox {...props} />}>
<Checkbox.Indicator render={(props) => <MyCheckboxIndicator {...props} />} />
</Checkbox.Root>
```

## Accessibility

Ensure the Checkbox has an accessible name via a `<label>` element.
Expand Down
20 changes: 10 additions & 10 deletions docs/data/base/components/number-field/number-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,6 @@ NumberField is implemented using a collection of related components:
</NumberField.Root>
```

## Overriding default components

Use the `render` prop to override the rendered elements with your own components.

```jsx
<NumberField.Input render={(props) => <MyCustomInput {...props} />}> />
```

All subcomponents accept the `render` prop.

## Value

### Default value
Expand Down Expand Up @@ -223,6 +213,16 @@ To allow the input to be scrubbed using the mouse wheel, add the `allowWheelScru

{{"demo": "UnstyledNumberFieldWheelScrub.js"}}

## Overriding default components

Use the `render` prop to override the rendered elements with your own components.

```jsx
<NumberField.Input render={(props) => <MyCustomInput {...props} />}> />
```

All subcomponents accept the `render` prop.

## Accessibility

Ensure the number field has an accessible name via a `<label/>` element.
24 changes: 12 additions & 12 deletions docs/data/base/components/tabs/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ Though not required, you can add the `value` prop to the Tab and Tab Panel to
</Tabs.Root>
```

## Overriding default components

Use the `render` prop to override the rendered element:

```jsx
<Tabs.Tab render={<MyCustomTab />} />
// or
<Tabs.Tab render={(props) => <MyCustomTab {...props} />} />
```

If you provide a non-interactive element such as a `<span>`, the Tab components automatically add the necessary accessibility attributes.

## Indicator

Though it's optional, the `Tabs.Indicator` component can be added to implement a visual indicator for the active tab.
Expand Down Expand Up @@ -162,6 +150,18 @@ Alternatively, you can set `activateOnFocus={false}` on `<Tabs.List>` so tabs ar
<Tabs.List activateOnFocus={false} />
```

## Overriding default components

Use the `render` prop to override the rendered element:

```jsx
<Tabs.Tab render={<MyCustomTab />} />
// or
<Tabs.Tab render={(props) => <MyCustomTab {...props} />} />
```

If you provide a non-interactive element such as a `<span>`, the Tab components automatically add the necessary accessibility attributes.

## Accessibility

Base UI Tabs follow the [Tabs WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
Expand Down

0 comments on commit 1129343

Please sign in to comment.