diff --git a/docs/data/base/components/autocomplete/autocomplete.md b/docs/data/base/components/autocomplete/autocomplete.md index 8fb75b38c29966..d0a0cb5de11e64 100644 --- a/docs/data/base/components/autocomplete/autocomplete.md +++ b/docs/data/base/components/autocomplete/autocomplete.md @@ -35,8 +35,6 @@ To learn more about implementing a custom Autocomplete, you can explore the [`us ## Hook -### Usage - ```jsx import { useAutocomplete } from '@mui/base/useAutocomplete'; ``` @@ -104,7 +102,7 @@ Learn more about controlled and uncontrolled components in the [React documentat React Portals can be used to render the listbox outside of the DOM hierarchy, making it easier to allow it to "float" above adjacent elements. -Base UI provides a [``](/base-ui/react-popper/) component built around React's `createPortal()` for exactly this purpose, and additionally helps you manage keyboard focus as it moves in and out of the portal. +Base UI provides a [Popper](/base-ui/react-popper/) component built around React's `createPortal()` for exactly this purpose, and additionally helps you manage keyboard focus as it moves in and out of the portal. To render the listbox in Base UI's Popper, the `ref`s must be merged as follows: diff --git a/docs/data/base/components/badge/badge.md b/docs/data/base/components/badge/badge.md index 50e46e3fe349bc..71f557d58fd79c 100644 --- a/docs/data/base/components/badge/badge.md +++ b/docs/data/base/components/badge/badge.md @@ -25,32 +25,15 @@ The Badge component creates a badge that is applied to its child element. ## Component -### Usage - -After [installation](/base-ui/getting-started/quickstart/#installation), you can start building with this component using the following basic elements: - ```jsx import { Badge } from '@mui/base/Badge'; - -export default function MyApp() { - return {/* the element that the badge is attached to */}; -} ``` -### Basics - The Badge wraps around the UI element that it's attached to. -For instance, if the badge indicates the number of emails in an inbox, then the component will be structured like this: - -```jsx - - - -``` ### Anatomy -The Badge component is composed of a root `` that houses the element that the badge is attached to, followed by a `` slot to represent the badge itself: +The Badge component is composed of a root `` that houses the element that the Badge is attached to, followed by a `` slot to represent the Badge itself: ```html @@ -79,9 +62,10 @@ The following code snippet applies a CSS class called `my-badge` to the badge sl ``` -#### Usage with TypeScript +### 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 slots={{ root: CustomComponent }} customProp /> @@ -99,10 +83,10 @@ The same applies for props specific to custom primitive elements: import { useBadge } from '@mui/base/useBadge'; ``` -The `useBadge` hook lets you apply the functionality of a badge to a fully custom component. +The `useBadge` hook lets you apply the functionality of a Badge 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](#slot-props), but they do support [customization props](#customization). +Hooks _do not_ support [slot props](#custom-structure), but they do support [customization props](#customization). :::info Hooks give you the most room for customization, but require more work to implement. @@ -120,27 +104,27 @@ For the sake of simplicity, demos and code snippets primarily feature components ### Badge content -The `badgeContent` prop defines the content that's displayed inside the badge. -When this content is a number, there are additional props you can use for further customization—see the [Numerical badges section](#numerical-badges) below. +The `badgeContent` prop defines the content that's displayed inside the Badge. +When this content is a number, there are additional props you can use for further customization—see the [Numerical Badges section](#numerical-badges) below. -The following demo shows how to create and style a typical numerical badge that's attached to a generic box element: +The following demo shows how to create and style a typical numerical Badge that's attached to a generic box element: {{"demo": "UnstyledBadge", "defaultCodeOpen": false}} ### Badge visibility -You can control the visibility of a badge by using the `invisible` prop. -Setting a badge to `invisible` does not actually hide it—instead, this prop adds the `BaseBadge-invisible` class to the badge, which you can target with styles to hide however you prefer: +You can control the visibility of a Badge by using the `invisible` prop. +Setting a Badge to `invisible` does not actually hide it—instead, this prop adds the `BaseBadge-invisible` class to the Badge, which you can target with styles to hide however you prefer: {{"demo": "BadgeVisibility.js"}} -### Numerical badges +### Numerical Badges The following props are useful when `badgeContent` is a number. #### The showZero prop -By default, badges automatically hide when `badgeContent={0}`. +By default, Badges automatically hide when `badgeContent={0}`. You can override this behavior with the `showZero` prop: {{"demo": "ShowZeroBadge.js"}} @@ -154,7 +138,7 @@ The default is 99. ## Accessibility -Screen readers may not provide users with enough information about a badge's contents. +Screen readers may not provide users with enough information about a Badge's contents. To make your badge accessible, you must provide a full description with `aria-label`, as shown in the demo below: {{"demo": "AccessibleBadges.js"}} diff --git a/docs/data/base/components/button/button.md b/docs/data/base/components/button/button.md index ded95fe3b98b7a..38412762441a86 100644 --- a/docs/data/base/components/button/button.md +++ b/docs/data/base/components/button/button.md @@ -23,20 +23,10 @@ The Button component replaces the native HTML `; -} ``` -### Basics - The Button behaves similar to the native HTML `