diff --git a/docs/data/base/components/badge/badge.md b/docs/data/base/components/badge/badge.md index 35937ce0265851..ec65a62c88a7c8 100644 --- a/docs/data/base/components/badge/badge.md +++ b/docs/data/base/components/badge/badge.md @@ -59,27 +59,17 @@ The Badge component is composed of a root `` that houses the element that ``` -### Slot props +### Custom structure -:::info -The following props are available on all non-utility Base components. -See [Usage](/base/getting-started/usage/) for full details. -::: - -Use the `component` prop to override the root slot with a custom element: - -```jsx - -``` - -Use the `slots` prop to override any interior slots in addition to the root: +Use the `slots` prop to override the root or any other interior slot: ```jsx ``` -:::warning -If the root element is customized with both the `component` and `slots` props, then `component` will take precedence. +:::info +The `slots` prop is available on all non-utility Base components. +See [Overriding component structure](/base/guides/overriding-component-structure/) for full details. ::: Use the `slotProps` prop to pass custom props to internal slots. @@ -89,6 +79,20 @@ The following code snippet applies a CSS class called `my-badge` to the badge 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: + +```tsx + slots={{ root: CustomComponent }} customProp /> +``` + +The same applies for props specific to custom primitive elements: + +```tsx + slots={{ root: 'img' }} src="badge.png" /> +``` + ## Hook ```jsx diff --git a/docs/data/base/components/button/button.md b/docs/data/base/components/button/button.md index f8247cbdff004a..72a5fc101e214a 100644 --- a/docs/data/base/components/button/button.md +++ b/docs/data/base/components/button/button.md @@ -80,7 +80,7 @@ Similarly, `