Skip to content

Commit

Permalink
switch
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelsycamore committed Sep 6, 2023
1 parent b877f77 commit ce60c09
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/data/base/components/switch/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ The Switch component provides users with a switch for toggling between two mutua

## Component

### Usage

```jsx
import { Switch } from '@mui/base/Switch';
```
Expand Down Expand Up @@ -63,7 +61,8 @@ The following code snippet applies a CSS class called `my-thumb` to the thumb sl

#### Usage with TypeScript

In TypeScript, you can specify the custom component type used in the `slots.root` as a generic parameter of the unstyled component. This way, you can safely provide the custom root's props directly on the component:
In TypeScript, you can specify the custom component type used in the `slots.root` as a generic parameter of the unstyled component.
This way, you can safely provide the custom root's props directly on the component:

```tsx
<Switch<typeof CustomComponent> slots={{ root: CustomComponent }} customProp />
Expand All @@ -81,7 +80,7 @@ The same applies for props specific to custom primitive elements:
import { useSwitch } from '@mui/base/useSwitch';
```

The `useSwitch` hook lets you apply the functionality of a switch to a fully custom component.
The `useSwitch` hook lets you apply the functionality of a Switch to a fully custom component.
It returns props to be placed on the custom component, along with fields representing the component's internal state.

Hooks _do not_ support [slot props](#custom-structure), but they do support [customization props](#customization).
Expand Down

0 comments on commit ce60c09

Please sign in to comment.