@wordpress/components
Version:
UI components for WordPress.
30 lines (19 loc) • 1.49 kB
text/mdx
import { Meta } from '@storybook/addon-docs/blocks';
import * as TipStories from './index.story';
<Meta of={ TipStories } name="Migration Guide" />
# Tip migration guide
`Tip` is deprecated since WordPress 7.2 and scheduled for removal in WordPress 7.4. Use [`Notice`](?path=/docs/design-system-components-notice--docs) from `@wordpress/ui` instead.
## Basic migration
Use `Notice.Root` with `intent="info"` and `Notice.Description` for the content. Pass the `tip` icon from `@wordpress/icons` to retain the light-bulb icon. The notice uses the design system's info colors, border, and padding.
```jsx
import { tip } from '@wordpress/icons';
import { Notice } from '@wordpress/ui';
const MyTip = ( { children } ) => (
<Notice.Root intent="info" icon={ tip }>
<Notice.Description>{ children }</Notice.Description>
</Notice.Root>
);
```
For a call to action, use `Notice.Actions` and `Notice.ActionLink`. Pass `openInNewTab` to retain an external link's new-tab indicator and accessible notice. Add `Notice.CloseIconButton` only if the consuming interface supports dismissal.
Like Tip, Notice does not announce its content automatically. Consumers must announce dynamic updates when needed. See the [Notice announcement guidance](?path=/docs/design-system-components-notice-announcements--docs).
The `.components-tip` selector belongs to the legacy component. Update custom consumer styles when migrating to Notice rather than carrying this class name into the new composition.