From d37dbe6f739f69a5e57fea729f159bfd038181dd Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Fri, 23 Oct 2026 18:57:23 +0300 Subject: [PATCH 01/14] Storybook: Add illustrated package cards to the Design System introduction Show Theming, Components, Icons, DataViews and Admin UI as cards with abstract SVG headers, a short description, and links to the Storybook page and the developer handbook. --- storybook/css-modules.d.ts | 4 + .../stories/design-system/introduction.mdx | 49 +- .../design-system/package-cards.module.scss | 26 + .../stories/design-system/package-cards.tsx | 484 ++++++++++++++++++ 4 files changed, 517 insertions(+), 46 deletions(-) create mode 100644 storybook/css-modules.d.ts create mode 100644 storybook/stories/design-system/package-cards.module.scss create mode 100644 storybook/stories/design-system/package-cards.tsx diff --git a/storybook/css-modules.d.ts b/storybook/css-modules.d.ts new file mode 100644 index 00000000000000..1952f616066ee8 --- /dev/null +++ b/storybook/css-modules.d.ts @@ -0,0 +1,4 @@ +declare module '*.module.scss' { + const classes: Record< string, string >; + export default classes; +} diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index b515bf68161287..ed5051296fc0d2 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -1,4 +1,5 @@ import { Meta } from '@storybook/addon-docs/blocks'; +import { PackageCards } from './package-cards'; @@ -29,57 +30,13 @@ In WordPress, when talking about the design system, we usually think of its scop The WordPress Design System consists of a few core packages: -#### Theming (`@wordpress/theme`) - -The foundational layer that provides: - -- **Design Tokens**: A comprehensive system of design tokens for colors, spacing, typography, shadows, and more. -- **Theme Provider**: A component that accepts seed values and automatically generates consistent, accessible color ramps and spacing scales. - -Explore the [Theme documentation](/story/design-system-theme-introduction--docs) to learn more about design tokens, the token architecture, and how to use `ThemeProvider`. - -#### Components (`@wordpress/ui`) - -A library of React UI components built on the theme foundation: - -- **Consistent patterns**: All components follow a consistent set of technical design principles to ensure that their usage is easy to understand and predictable. -- **Token-driven styling**: Components use design tokens for all visual properties, ensuring they automatically adapt to theme changes. -- **Accessible by default**: Built with WordPress accessibility coding standards in mind, including semantic markup, keyboard navigation, and proper color contrast. - -Explore the [Components documentation](/story/design-system-components-introduction--docs) to learn more about the component library and usage patterns. - -#### Icons (`@wordpress/icons`) - -A curated library of SVG icons for use throughout WordPress interfaces: - -- **Comprehensive coverage**: A broad set of icons spanning common editor and admin actions. -- **Composable**: Each icon is exported as a React component and can be rendered directly or through the `` wrapper with adjustable size. -- **Consistent visual language**: Drawn to a shared style so icons feel coherent wherever they appear across WordPress. - -See the [`@wordpress/icons` README](https://github.com/WordPress/gutenberg/tree/trunk/packages/icons) for usage details. + ### Compositional Packages Higher-level compositional packages use the design system to provide solutions for common UI patterns: -#### DataViews (`@wordpress/dataviews`) - -A set of components and utilities for displaying, filtering, and editing lists of data: - -- **Multiple layouts**: Render the same dataset as a table, grid, or list, with built-in search, filters, sorting, and pagination. -- **Selection and editing**: `DataViewsPicker` optimizes the same experience for selecting items from a dataset, while `DataForm` handles creating and editing individual records. -- **Declarative fields**: Drive rendering and behavior through field definitions rather than bespoke markup for each column or form. - -See the [`@wordpress/dataviews` README](https://github.com/WordPress/gutenberg/tree/trunk/packages/dataviews) for API reference and usage guidance. - -#### Admin UI (`@wordpress/admin-ui`) - -High-level building blocks for consistent WordPress admin page layouts: - -- **Page structure**: Abstractions for pages, sidebars, headers, and navigation that encode the expected shape of an admin screen. -- **Consistency by default**: Enforces a predictable admin experience across features without each team re-deriving the same layout patterns. - -See the [`@wordpress/admin-ui` README](https://github.com/WordPress/gutenberg/tree/trunk/packages/admin-ui) for API reference and usage guidance. + ## Principles of the Design System diff --git a/storybook/stories/design-system/package-cards.module.scss b/storybook/stories/design-system/package-cards.module.scss new file mode 100644 index 00000000000000..2eb6eef8bff4ed --- /dev/null +++ b/storybook/stories/design-system/package-cards.module.scss @@ -0,0 +1,26 @@ +.card-group { + margin-block: 24px; +} + +.card { + // Three per row when there is room; wrap rather than get narrower than 16rem. + flex: 1 1 16rem; + min-width: min(16rem, 100%); + max-width: 100%; +} + +.illustration { + display: block; + width: 100%; + height: auto; + aspect-ratio: 2 / 1; +} + +// `sb-unstyled` on the card opts it out of Storybook's docs resets, which are +// unlayered and would otherwise zero the margins Card.FullBleed relies on. + +// Card.Content pads 24px on every side; the illustration above already ends +// flush, so half of that is enough between it and the heading. +.body { + padding-block-start: var(--wpds-dimension-padding-md); +} diff --git a/storybook/stories/design-system/package-cards.tsx b/storybook/stories/design-system/package-cards.tsx new file mode 100644 index 00000000000000..0d8f1331c5c7d1 --- /dev/null +++ b/storybook/stories/design-system/package-cards.tsx @@ -0,0 +1,484 @@ +import { + Icon, + bell, + calendar, + check, + cog, + comment, + globe, + home, + image, + link as linkIcon, + lock, + media, + page, + pencil, + plus, + search, + starFilled, + tag, + trash, +} from '@wordpress/icons'; +import { Card, Link, Stack, Text } from '@wordpress/ui'; +import styles from './package-cards.module.scss'; + +const brand = 'var(--wpds-color-background-interactive-brand-strong)'; +const neutral = 'var(--wpds-color-background-interactive-neutral)'; +const surface = 'var(--wpds-color-background-surface-neutral-strong)'; +const surfaceWeak = 'var(--wpds-color-background-surface-neutral-weak)'; +const foreground = 'var(--wpds-color-foreground-content-neutral)'; +const stroke = 'var(--wpds-color-stroke-surface-neutral)'; +const muted = 'var(--wpds-color-stroke-surface-neutral-weak)'; + +// Corner radii follow the tokens used by the real components: `sm` for +// buttons, inputs and tiles, `xs` for checkboxes, `lg` for cards and panels. +const radius = ( value: string ) => ( { rx: value } ) as React.CSSProperties; +const r = { + xs: radius( 'min(var(--wpds-border-radius-sm), 2px)' ), + sm: radius( 'var(--wpds-border-radius-sm)' ), + lg: radius( 'var(--wpds-border-radius-lg)' ), +}; + +const Illustration = ( { children }: { children: React.ReactNode } ) => ( + +); + +/** Color swatches in a ramp, above a row of token-like bars. */ +const ThemingIllustration = () => ( + + { [ 0.2, 0.4, 0.6, 0.8, 1 ].map( ( o, i ) => ( + + ) ) } + { [ 0.2, 0.4, 0.6, 0.8, 1 ].map( ( o, i ) => ( + + ) ) } + +); + +/** A button, a text field, a toggle and a checkbox. */ +const ComponentsIllustration = () => ( + + + + + + + + + + + +); + +const glyphs = [ + pencil, + plus, + trash, + cog, + image, + page, + home, + search, + starFilled, + check, + comment, + linkIcon, + tag, + calendar, + lock, + media, + bell, + globe, +]; + +/** A grid of real icons from the library. */ +const IconsIllustration = () => ( + + { glyphs.map( ( glyph, i ) => { + const x = 44 + ( i % 6 ) * 40; + const y = 24 + Math.floor( i / 6 ) * 40; + return ( + + + + + + + ); + } ) } + +); + +/** A table with a filter bar and selectable rows. */ +const DataViewsIllustration = () => ( + + + + + { [ 0, 1, 2, 3 ].map( ( i ) => { + const top = 62 + i * 18; + return ( + + + + + + + ); + } ) } + +); + +/** A page frame: full-height sidebar, header with one primary action, content. */ +const AdminUIIllustration = () => ( + + + + + + + + + + + + { [ 0, 1, 2, 3 ].map( ( i ) => ( + + ) ) } + + + + + + +); + +const illustrations = { + theming: ThemingIllustration, + components: ComponentsIllustration, + icons: IconsIllustration, + dataviews: DataViewsIllustration, + adminui: AdminUIIllustration, +}; + +const PackageCard = ( { + illustration, + title, + packageName, + children, + storybookId, + docsHref, +}: { + illustration: keyof typeof illustrations; + title: string; + packageName: string; + children: React.ReactNode; + storybookId: string; + docsHref: string; +} ) => { + const Art = illustrations[ illustration ]; + return ( + + + + + + + + + + }> + { title } + + }> + { packageName } + + + }> + { children } + + + + See more + + + Developer documentation + + + + + + ); +}; + +const handbook = + 'https://developer.wordpress.org/block-editor/reference-guides/packages'; + +const cards: Array< { + illustration: keyof typeof illustrations; + title: string; + packageName: string; + body: string; + storybookId: string; + docsHref: string; +} > = [ + { + illustration: 'theming', + title: 'Theming', + packageName: '@wordpress/theme', + body: 'Design tokens for colors, spacing, typography and more, plus a ThemeProvider that generates accessible color ramps from seed values.', + storybookId: 'design-system-theme-introduction--docs', + docsHref: `${ handbook }/packages-theme/`, + }, + { + illustration: 'components', + title: 'Components', + packageName: '@wordpress/ui', + body: 'Themeable, accessible React components with consistent patterns, styled entirely with design tokens.', + storybookId: 'design-system-components-introduction--docs', + docsHref: `${ handbook }/packages-ui/`, + }, + { + illustration: 'icons', + title: 'Icons', + packageName: '@wordpress/icons', + body: 'A curated library of SVG icons covering common editor and admin actions, drawn in one shared visual language.', + storybookId: 'icons-icon--docs', + docsHref: `${ handbook }/packages-icons/`, + }, + { + illustration: 'dataviews', + title: 'DataViews', + packageName: '@wordpress/dataviews', + body: 'Display, filter and edit lists of data as a table, grid or list, with DataForm for editing individual records.', + storybookId: 'dataviews-dataviews--docs', + docsHref: `${ handbook }/packages-dataviews/`, + }, + { + illustration: 'adminui', + title: 'Admin UI', + packageName: '@wordpress/admin-ui', + body: 'Building blocks for consistent admin page layouts: pages, headers, sidebars and navigation.', + storybookId: 'admin-ui-page--docs', + docsHref: `${ handbook }/packages-admin-ui/`, + }, +]; + +export const PackageCards = ( { + only, +}: { + only: Array< keyof typeof illustrations >; +} ) => ( + + { cards + .filter( ( card ) => only.includes( card.illustration ) ) + .map( ( { body, ...card } ) => ( + + { body } + + ) ) } + +); From 5c34f8e0e2a562f8db5caa5819ab41cfcbaef7b6 Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Fri, 23 Oct 2026 19:17:37 +0300 Subject: [PATCH 02/14] Storybook: Refine Design System introduction page Rework the copy, show the principles as cards, and tune the package cards. --- .../stories/design-system/introduction.mdx | 25 ++---- .../design-system/package-cards.module.scss | 8 ++ .../stories/design-system/principle-cards.tsx | 77 +++++++++++++++++++ 3 files changed, 93 insertions(+), 17 deletions(-) create mode 100644 storybook/stories/design-system/principle-cards.tsx diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index ed5051296fc0d2..a16cee9d943075 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -1,5 +1,6 @@ import { Meta } from '@storybook/addon-docs/blocks'; import { PackageCards } from './package-cards'; +import { PrincipleCards } from './principle-cards'; @@ -7,28 +8,21 @@ import { PackageCards } from './package-cards'; The WordPress Design System is a collection of reusable components, design tokens, and guidelines for building consistent, accessible user interfaces in the WordPress administrative dashboard. -Rather than building UI elements from scratch each time, a design system provides pre-built, themeable components built on a foundation of design tokens. Design tokens encode design decisions like colors, spacing, and typography and can be customized to match different contexts while maintaining consistency. +It is what WordPress itself is built with, and it is available to plugin developers too. Interfaces made from the same components and tokens look and behave like the rest of WordPress, so your plugin's screens feel native to the dashboard instead of bolted on. -## Using the Design System +## Build with the Design System -Most often, you'll be interested in using components of the design system, like those provided through [the `@wordpress/ui` package](https://github.com/WordPress/gutenberg/blob/trunk/packages/ui/README.md) and other packages described below in "Parts of the Design System". +Use [Admin UI](?path=/docs/admin-ui-page--docs), [DataViews](?path=/docs/dataviews-dataviews--docs) and [DataForm](?path=/docs/dataviews-dataform--docs) to build new table and form based interfaces. Use the [components](?path=/docs/design-system-components-introduction--docs) to build completely new custom interfaces. -If you want to build your own components that inherit the same styles as the design system's own components, the [theming system](/story/design-system-theme-introduction--docs) provides a number of [custom CSS properties](https://github.com/WordPress/gutenberg/blob/trunk/packages/theme/docs/tokens.md) that you can use in your own stylesheet. +When building your own components, use [design tokens](https://github.com/WordPress/gutenberg/blob/trunk/packages/theme/docs/tokens.md) as part of your component styles to stay aligned with the design system's own components. The [theming system](?path=/docs/design-system-theme-introduction--docs) provides them as custom CSS properties that you can use in your own stylesheet. -The [WordPress Design System MCP Server](?path=/docs/design-system-using-with-ai--docs) is recommended when working with AI agents for design or development in a project that uses the design system. It provides AI agents with component documentation, usage examples, and design tokens, so they correctly follow the latest design system guidance. +When working with AI agents, use the [WordPress Design System MCP Server](?path=/docs/design-system-using-with-ai--docs). It gives agents the latest component documentation, usage examples, and design tokens. ## Parts of the Design System -Describing the parts of a design system can be challenging, because ideally every part of the application inherits and builds from the design system fundamentals in some way. - -In WordPress, when talking about the design system, we usually think of its scope including: - -- **Foundational packages** establish the fundamental components and theming behaviors. As a low-level implementation, they are meant to be highly flexible, but this flexibility can make them difficult to work with. -- **Compositional packages** operate at a higher-level, providing developer conveniences for composing the foundational elements of the design system into common solutions. These components optimize for predictable user experiences, sometimes intentionally limiting configurability in service of consistency. - ### Foundational Packages -The WordPress Design System consists of a few core packages: +Foundational packages establish the fundamental components and theming behaviors. @@ -42,10 +36,7 @@ Higher-level compositional packages use the design system to provide solutions f The design system is guided by a few principles that distinguish it from the existing [@wordpress/components](https://github.com/WordPress/gutenberg/tree/trunk/packages/components) package: -- **Cohesive by design**: Unlike `@wordpress/components`, which grew organically as a collection of unrelated UI elements, this design system guarantees user- and developer-facing cohesion through a unified token system and consistent component patterns. -- **Flexible theming**: Built from the ground up to support customizable color schemes and user personalization—capabilities needed to support the [Phase 3 admin redesign initiative](https://github.com/WordPress/gutenberg/issues/71196). -- **Modern distribution**: Distributed as a versioned npm package following [semantic versioning](https://semver.org/), rather than being bundled as a WordPress script on the `window.wp` global. -- **Composable architecture**: Components follow consistent patterns with proper composability, ref forwarding, and flexible rendering—avoiding the bloated abstractions that emerged from historical scope creep. + For more context on the motivations and goals behind this work, see the [Design System: Support for admin redesign](https://github.com/WordPress/gutenberg/issues/71196) overview issue. diff --git a/storybook/stories/design-system/package-cards.module.scss b/storybook/stories/design-system/package-cards.module.scss index 2eb6eef8bff4ed..7a90427c5512ac 100644 --- a/storybook/stories/design-system/package-cards.module.scss +++ b/storybook/stories/design-system/package-cards.module.scss @@ -9,6 +9,14 @@ max-width: 100%; } +.principle-card { + // Never more than two per row: half the row (minus half the gap) once two + // fit at 20rem or more, otherwise one per row. + flex: 1 1 max(20rem, calc(50% - var(--wpds-dimension-gap-lg) / 2)); + min-width: min(20rem, 100%); + max-width: 100%; +} + .illustration { display: block; width: 100%; diff --git a/storybook/stories/design-system/principle-cards.tsx b/storybook/stories/design-system/principle-cards.tsx new file mode 100644 index 00000000000000..82b01742e050a3 --- /dev/null +++ b/storybook/stories/design-system/principle-cards.tsx @@ -0,0 +1,77 @@ +import { Card, Link, Stack, Text } from '@wordpress/ui'; +import styles from './package-cards.module.scss'; + +const principles = [ + { + title: 'Cohesive by design', + body: ( + <> + Unlike @wordpress/components, which grew + organically as a collection of unrelated UI elements, this + design system guarantees user- and developer-facing cohesion + through a unified token system and consistent component + patterns. + + ), + }, + { + title: 'Flexible theming', + body: ( + <> + Built from the ground up to support customizable color schemes + and user personalization—capabilities needed to support the{ ' ' } + + Phase 3 admin redesign initiative + + . + + ), + }, + { + title: 'Modern distribution', + body: ( + <> + Distributed as a versioned npm package following{ ' ' } + + semantic versioning + + , rather than being bundled as a WordPress script on the{ ' ' } + window.wp global. + + ), + }, + { + title: 'Composable architecture', + body: 'Components follow consistent patterns with proper composability, ref forwarding, and flexible rendering—avoiding the bloated abstractions that emerged from historical scope creep.', + }, +]; + +export const PrincipleCards = () => ( + + { principles.map( ( { title, body } ) => ( + + + + }> + { title } + + }> + { body } + + + + + ) ) } + +); From b240f5cace51134432a8c4a810aa08c2424d6316 Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Fri, 23 Oct 2026 19:27:48 +0300 Subject: [PATCH 03/14] Storybook: Cap package card width and simplify the Admin UI description --- storybook/stories/design-system/package-cards.module.scss | 7 +++++++ storybook/stories/design-system/package-cards.tsx | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/storybook/stories/design-system/package-cards.module.scss b/storybook/stories/design-system/package-cards.module.scss index 7a90427c5512ac..3c663e00df176b 100644 --- a/storybook/stories/design-system/package-cards.module.scss +++ b/storybook/stories/design-system/package-cards.module.scss @@ -1,5 +1,6 @@ .card-group { margin-block: 24px; + container-type: inline-size; } .card { @@ -7,6 +8,12 @@ flex: 1 1 16rem; min-width: min(16rem, 100%); max-width: 100%; + + // Once two cards fit in a row, never let a lone card on a wrapped row + // stretch past half of the container. + @container (min-width: 33rem) { + max-width: calc(50% - var(--wpds-dimension-gap-lg) / 2); + } } .principle-card { diff --git a/storybook/stories/design-system/package-cards.tsx b/storybook/stories/design-system/package-cards.tsx index 0d8f1331c5c7d1..83030f4dd4a84f 100644 --- a/storybook/stories/design-system/package-cards.tsx +++ b/storybook/stories/design-system/package-cards.tsx @@ -456,7 +456,7 @@ const cards: Array< { illustration: 'adminui', title: 'Admin UI', packageName: '@wordpress/admin-ui', - body: 'Building blocks for consistent admin page layouts: pages, headers, sidebars and navigation.', + body: 'Building blocks for consistent admin page layouts and headers.', storybookId: 'admin-ui-page--docs', docsHref: `${ handbook }/packages-admin-ui/`, }, From aca6e1536a0df33b67275b5fa076806570e42afa Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Fri, 23 Oct 2026 21:07:38 +0300 Subject: [PATCH 04/14] Storybook: Link the Figma design resources from the Design System introduction --- storybook/stories/design-system/introduction.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index a16cee9d943075..e0a8207af81c7f 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -18,6 +18,8 @@ When building your own components, use [design tokens](https://github.com/WordPr When working with AI agents, use the [WordPress Design System MCP Server](?path=/docs/design-system-using-with-ai--docs). It gives agents the latest component documentation, usage examples, and design tokens. +Designers can find the matching design resources in the [WordPress Design System on Figma](https://www.figma.com/@wordpressds). + ## Parts of the Design System ### Foundational Packages From 34314a9c302b00d0c0bba5721612d57a0e29eb9d Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Wed, 18 Nov 2026 16:11:08 +0200 Subject: [PATCH 05/14] Storybook: Keep the introduction copy in the MDX Pass the card descriptions to the card components as children instead of holding them in component data, so the human-readable text lives in the Markdown. --- .../stories/design-system/introduction.mdx | 70 +++++++++++++- .../stories/design-system/package-cards.tsx | 69 +------------- .../stories/design-system/principle-cards.tsx | 93 ++++++------------- 3 files changed, 95 insertions(+), 137 deletions(-) diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index e0a8207af81c7f..26e8619962fe3f 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -1,6 +1,6 @@ import { Meta } from '@storybook/addon-docs/blocks'; -import { PackageCards } from './package-cards'; -import { PrincipleCards } from './principle-cards'; +import { PackageCard, PackageCards } from './package-cards'; +import { PrincipleCard, PrincipleCards } from './principle-cards'; @@ -26,19 +26,79 @@ Designers can find the matching design resources in the [WordPress Design System Foundational packages establish the fundamental components and theming behaviors. - + + + Design tokens for colors, spacing, typography and more, plus a ThemeProvider that generates accessible color ramps from seed values. + + + Themeable, accessible React components with consistent patterns, styled entirely with design tokens. + + + A curated library of SVG icons covering common editor and admin actions, drawn in one shared visual language. + + ### Compositional Packages Higher-level compositional packages use the design system to provide solutions for common UI patterns: - + + + Display, filter and edit lists of data as a table, grid or list, with DataForm for editing individual records. + + + Building blocks for consistent admin page layouts and headers. + + ## Principles of the Design System The design system is guided by a few principles that distinguish it from the existing [@wordpress/components](https://github.com/WordPress/gutenberg/tree/trunk/packages/components) package: - + + + Unlike `@wordpress/components`, which grew organically as a collection of unrelated UI elements, this design system guarantees user- and developer-facing cohesion through a unified token system and consistent component patterns. + + + Built from the ground up to support customizable color schemes and user personalization—capabilities needed to support the [Phase 3 admin redesign initiative](https://github.com/WordPress/gutenberg/issues/71196). + + + Distributed as a versioned npm package following [semantic versioning](https://semver.org/), rather than being bundled as a WordPress script on the `window.wp` global. + + + Components follow consistent patterns with proper composability, ref forwarding, and flexible rendering—avoiding the bloated abstractions that emerged from historical scope creep. + + For more context on the motivations and goals behind this work, see the [Design System: Support for admin redesign](https://github.com/WordPress/gutenberg/issues/71196) overview issue. diff --git a/storybook/stories/design-system/package-cards.tsx b/storybook/stories/design-system/package-cards.tsx index 83030f4dd4a84f..b1353c3b7eaf7b 100644 --- a/storybook/stories/design-system/package-cards.tsx +++ b/storybook/stories/design-system/package-cards.tsx @@ -356,7 +356,7 @@ const illustrations = { adminui: AdminUIIllustration, }; -const PackageCard = ( { +export const PackageCard = ( { illustration, title, packageName, @@ -409,76 +409,13 @@ const PackageCard = ( { ); }; -const handbook = - 'https://developer.wordpress.org/block-editor/reference-guides/packages'; - -const cards: Array< { - illustration: keyof typeof illustrations; - title: string; - packageName: string; - body: string; - storybookId: string; - docsHref: string; -} > = [ - { - illustration: 'theming', - title: 'Theming', - packageName: '@wordpress/theme', - body: 'Design tokens for colors, spacing, typography and more, plus a ThemeProvider that generates accessible color ramps from seed values.', - storybookId: 'design-system-theme-introduction--docs', - docsHref: `${ handbook }/packages-theme/`, - }, - { - illustration: 'components', - title: 'Components', - packageName: '@wordpress/ui', - body: 'Themeable, accessible React components with consistent patterns, styled entirely with design tokens.', - storybookId: 'design-system-components-introduction--docs', - docsHref: `${ handbook }/packages-ui/`, - }, - { - illustration: 'icons', - title: 'Icons', - packageName: '@wordpress/icons', - body: 'A curated library of SVG icons covering common editor and admin actions, drawn in one shared visual language.', - storybookId: 'icons-icon--docs', - docsHref: `${ handbook }/packages-icons/`, - }, - { - illustration: 'dataviews', - title: 'DataViews', - packageName: '@wordpress/dataviews', - body: 'Display, filter and edit lists of data as a table, grid or list, with DataForm for editing individual records.', - storybookId: 'dataviews-dataviews--docs', - docsHref: `${ handbook }/packages-dataviews/`, - }, - { - illustration: 'adminui', - title: 'Admin UI', - packageName: '@wordpress/admin-ui', - body: 'Building blocks for consistent admin page layouts and headers.', - storybookId: 'admin-ui-page--docs', - docsHref: `${ handbook }/packages-admin-ui/`, - }, -]; - -export const PackageCards = ( { - only, -}: { - only: Array< keyof typeof illustrations >; -} ) => ( +export const PackageCards = ( { children }: { children: React.ReactNode } ) => ( - { cards - .filter( ( card ) => only.includes( card.illustration ) ) - .map( ( { body, ...card } ) => ( - - { body } - - ) ) } + { children } ); diff --git a/storybook/stories/design-system/principle-cards.tsx b/storybook/stories/design-system/principle-cards.tsx index 82b01742e050a3..53acff0ece2d6f 100644 --- a/storybook/stories/design-system/principle-cards.tsx +++ b/storybook/stories/design-system/principle-cards.tsx @@ -1,77 +1,38 @@ -import { Card, Link, Stack, Text } from '@wordpress/ui'; +import { Card, Stack, Text } from '@wordpress/ui'; import styles from './package-cards.module.scss'; -const principles = [ - { - title: 'Cohesive by design', - body: ( - <> - Unlike @wordpress/components, which grew - organically as a collection of unrelated UI elements, this - design system guarantees user- and developer-facing cohesion - through a unified token system and consistent component - patterns. - - ), - }, - { - title: 'Flexible theming', - body: ( - <> - Built from the ground up to support customizable color schemes - and user personalization—capabilities needed to support the{ ' ' } - - Phase 3 admin redesign initiative - - . - - ), - }, - { - title: 'Modern distribution', - body: ( - <> - Distributed as a versioned npm package following{ ' ' } - - semantic versioning - - , rather than being bundled as a WordPress script on the{ ' ' } - window.wp global. - - ), - }, - { - title: 'Composable architecture', - body: 'Components follow consistent patterns with proper composability, ref forwarding, and flexible rendering—avoiding the bloated abstractions that emerged from historical scope creep.', - }, -]; +export const PrincipleCard = ( { + title, + children, +}: { + title: string; + children: React.ReactNode; +} ) => ( + + + + }> + { title } + + }> + { children } + + + + +); -export const PrincipleCards = () => ( +export const PrincipleCards = ( { + children, +}: { + children: React.ReactNode; +} ) => ( - { principles.map( ( { title, body } ) => ( - - - - }> - { title } - - }> - { body } - - - - - ) ) } + { children } ); From d5407874badef87033625f8e02b8f4ae773104af Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Tue, 24 Nov 2026 13:14:37 +0200 Subject: [PATCH 06/14] Storybook: Remove redundant CSS modules declaration The storybook tsconfig already gets the *.module.scss typings from the style-imports types. --- storybook/css-modules.d.ts | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 storybook/css-modules.d.ts diff --git a/storybook/css-modules.d.ts b/storybook/css-modules.d.ts deleted file mode 100644 index 1952f616066ee8..00000000000000 --- a/storybook/css-modules.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.module.scss' { - const classes: Record< string, string >; - export default classes; -} From 31d8e4aa727e22c8cdafeee05d2fc1a1b89976f4 Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Tue, 24 Nov 2026 13:17:05 +0200 Subject: [PATCH 07/14] Storybook: Make the package card link text descriptive Use "Learn more about " instead of "See more", since the title is already known. --- storybook/stories/design-system/package-cards.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storybook/stories/design-system/package-cards.tsx b/storybook/stories/design-system/package-cards.tsx index b1353c3b7eaf7b..220f2d0ff41783 100644 --- a/storybook/stories/design-system/package-cards.tsx +++ b/storybook/stories/design-system/package-cards.tsx @@ -397,7 +397,7 @@ export const PackageCard = ( { href={ `./?path=/docs/${ storybookId }` } target="_top" > - See more + Learn more about { title } </Link> <Link href={ docsHref } openInNewTab> Developer documentation From f1a98ed9d6f41ad8cd4be713061c769e5ce9daa9 Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:18:01 +0200 Subject: [PATCH 08/14] Don't open docs links in new tabs Co-authored-by: Andrew Duthie <1779930+aduth@users.noreply.github.com> --- storybook/stories/design-system/package-cards.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storybook/stories/design-system/package-cards.tsx b/storybook/stories/design-system/package-cards.tsx index 220f2d0ff41783..a735b45e674620 100644 --- a/storybook/stories/design-system/package-cards.tsx +++ b/storybook/stories/design-system/package-cards.tsx @@ -399,7 +399,7 @@ export const PackageCard = ( { > Learn more about { title } </Link> - <Link href={ docsHref } openInNewTab> + <Link href={ docsHref }> Developer documentation </Link> </Stack> From f6d6dedf762cc99b01511910f378cf1a76ecd61f Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:20:30 +0200 Subject: [PATCH 09/14] Storybook: Split the introduction cards into one component per file Move the package and principle cards, the shared illustration wrapper and each illustration into storybook/stories/design-system/intro-cards. --- .../intro-cards/admin-ui-illustration.tsx | 87 ++++ .../intro-cards/components-illustration.tsx | 70 +++ .../intro-cards/dataviews-illustration.tsx | 75 ++++ .../intro-cards/icons-illustration.tsx | 71 +++ .../intro-cards/illustration.tsx | 15 + .../design-system/intro-cards/index.ts | 4 + .../intro-cards/package-card.tsx | 66 +++ .../intro-cards/package-cards.tsx | 13 + .../design-system/intro-cards/palette.ts | 16 + .../principle-card.tsx} | 17 +- .../intro-cards/principle-cards.tsx | 17 + .../style.module.scss} | 0 .../intro-cards/theming-illustration.tsx | 32 ++ .../stories/design-system/introduction.mdx | 8 +- .../stories/design-system/package-cards.tsx | 421 ------------------ 15 files changed, 473 insertions(+), 439 deletions(-) create mode 100644 storybook/stories/design-system/intro-cards/admin-ui-illustration.tsx create mode 100644 storybook/stories/design-system/intro-cards/components-illustration.tsx create mode 100644 storybook/stories/design-system/intro-cards/dataviews-illustration.tsx create mode 100644 storybook/stories/design-system/intro-cards/icons-illustration.tsx create mode 100644 storybook/stories/design-system/intro-cards/illustration.tsx create mode 100644 storybook/stories/design-system/intro-cards/index.ts create mode 100644 storybook/stories/design-system/intro-cards/package-card.tsx create mode 100644 storybook/stories/design-system/intro-cards/package-cards.tsx create mode 100644 storybook/stories/design-system/intro-cards/palette.ts rename storybook/stories/design-system/{principle-cards.tsx => intro-cards/principle-card.tsx} (65%) create mode 100644 storybook/stories/design-system/intro-cards/principle-cards.tsx rename storybook/stories/design-system/{package-cards.module.scss => intro-cards/style.module.scss} (100%) create mode 100644 storybook/stories/design-system/intro-cards/theming-illustration.tsx delete mode 100644 storybook/stories/design-system/package-cards.tsx diff --git a/storybook/stories/design-system/intro-cards/admin-ui-illustration.tsx b/storybook/stories/design-system/intro-cards/admin-ui-illustration.tsx new file mode 100644 index 00000000000000..37b869dff6ecdb --- /dev/null +++ b/storybook/stories/design-system/intro-cards/admin-ui-illustration.tsx @@ -0,0 +1,87 @@ +import { Illustration } from './illustration'; +import { + brand, + neutral, + surface, + surfaceWeak, + stroke, + muted, + r, +} from './palette'; + +/** A page frame: full-height sidebar, header with one primary action, content. */ +export const AdminUIIllustration = () => ( + <Illustration> + <clipPath id="package-cards-admin-ui-frame"> + <rect x="40" y="20" width="240" height="120" style={ r.lg } /> + </clipPath> + <rect + x="40" + y="20" + width="240" + height="120" + style={ r.lg } + fill={ surface } + /> + <g clipPath="url(#package-cards-admin-ui-frame)"> + <rect x="40" y="20" width="60" height="120" fill={ surfaceWeak } /> + </g> + <line x1="100" x2="100" y1="20" y2="140" stroke={ muted } /> + <line x1="100" x2="280" y1="46" y2="46" stroke={ muted } /> + <rect x="52" y="30" width="24" height="8" rx="4" fill={ neutral } /> + { [ 0, 1, 2, 3 ].map( ( i ) => ( + <rect + key={ i } + x="52" + y={ 58 + i * 18 } + width="36" + height="6" + rx="3" + fill={ neutral } + opacity={ i === 0 ? 0.7 : 0.35 } + /> + ) ) } + <rect + x="112" + y="30" + width="56" + height="8" + rx="4" + fill={ neutral } + opacity="0.6" + /> + <rect + x="244" + y="28" + width="24" + height="12" + style={ r.sm } + fill={ brand } + /> + <rect + x="112" + y="58" + width="156" + height="28" + style={ r.sm } + fill={ surfaceWeak } + /> + <rect + x="112" + y="96" + width="156" + height="32" + style={ r.sm } + fill={ surfaceWeak } + /> + <rect + x="40" + y="20" + width="240" + height="120" + style={ r.lg } + fill="none" + stroke={ stroke } + /> + </Illustration> +); diff --git a/storybook/stories/design-system/intro-cards/components-illustration.tsx b/storybook/stories/design-system/intro-cards/components-illustration.tsx new file mode 100644 index 00000000000000..48e08568d453d3 --- /dev/null +++ b/storybook/stories/design-system/intro-cards/components-illustration.tsx @@ -0,0 +1,70 @@ +import { Illustration } from './illustration'; +import { brand, neutral, surface, stroke, r } from './palette'; + +/** A button, a text field, a toggle and a checkbox. */ +export const ComponentsIllustration = () => ( + <Illustration> + <rect + x="40" + y="32" + width="96" + height="32" + style={ r.sm } + fill={ brand } + /> + <rect + x="148" + y="32" + width="96" + height="32" + style={ r.sm } + fill={ surface } + stroke={ stroke } + /> + <rect + x="160" + y="45" + width="72" + height="6" + rx="3" + fill={ neutral } + opacity="0.5" + /> + <rect + x="40" + y="80" + width="204" + height="32" + style={ r.sm } + fill={ surface } + stroke={ stroke } + /> + <rect + x="52" + y="93" + width="80" + height="6" + rx="3" + fill={ neutral } + opacity="0.5" + /> + <rect x="256" y="40" width="32" height="18" rx="9" fill={ brand } /> + <circle cx="279" cy="49" r="6" fill={ surface } /> + <rect + x="256" + y="86" + width="20" + height="20" + style={ r.xs } + fill={ brand } + /> + <path + d="M261 96l4 4 7-8" + fill="none" + stroke={ surface } + strokeWidth="2.5" + strokeLinecap="round" + strokeLinejoin="round" + /> + </Illustration> +); diff --git a/storybook/stories/design-system/intro-cards/dataviews-illustration.tsx b/storybook/stories/design-system/intro-cards/dataviews-illustration.tsx new file mode 100644 index 00000000000000..2a13e9edc378c4 --- /dev/null +++ b/storybook/stories/design-system/intro-cards/dataviews-illustration.tsx @@ -0,0 +1,75 @@ +import { Illustration } from './illustration'; +import { brand, neutral, surface, stroke, muted, r } from './palette'; + +/** A table with a filter bar and selectable rows. */ +export const DataViewsIllustration = () => ( + <Illustration> + <rect + x="40" + y="24" + width="240" + height="112" + style={ r.lg } + fill={ surface } + stroke={ stroke } + /> + <rect + x="52" + y="36" + width="64" + height="14" + style={ r.sm } + fill={ surface } + stroke={ stroke } + /> + <rect + x="124" + y="36" + width="40" + height="14" + style={ r.sm } + fill={ brand } + /> + { [ 0, 1, 2, 3 ].map( ( i ) => { + const top = 62 + i * 18; + return ( + <g key={ i }> + <line + x1="40" + x2="280" + y1={ top } + y2={ top } + stroke={ muted } + /> + <rect + x="52" + y={ top + 5 } + width="8" + height="8" + style={ r.xs } + fill={ i === 1 ? brand : 'none' } + stroke={ i === 1 ? brand : stroke } + /> + <rect + x="74" + y={ top + 6 } + width={ 70 + ( ( i * 23 ) % 40 ) } + height="6" + rx="3" + fill={ neutral } + opacity="0.5" + /> + <rect + x="200" + y={ top + 6 } + width="60" + height="6" + rx="3" + fill={ neutral } + opacity="0.25" + /> + </g> + ); + } ) } + </Illustration> +); diff --git a/storybook/stories/design-system/intro-cards/icons-illustration.tsx b/storybook/stories/design-system/intro-cards/icons-illustration.tsx new file mode 100644 index 00000000000000..e3aad1bb929f2b --- /dev/null +++ b/storybook/stories/design-system/intro-cards/icons-illustration.tsx @@ -0,0 +1,71 @@ +import { + Icon, + bell, + calendar, + check, + cog, + comment, + globe, + home, + image, + link as linkIcon, + lock, + media, + page, + pencil, + plus, + search, + starFilled, + tag, + trash, +} from '@wordpress/icons'; +import { Illustration } from './illustration'; +import { brand, surface, foreground, muted, r } from './palette'; + +const glyphs = [ + pencil, + plus, + trash, + cog, + image, + page, + home, + search, + starFilled, + check, + comment, + linkIcon, + tag, + calendar, + lock, + media, + bell, + globe, +]; + +/** A grid of real icons from the library. */ +export const IconsIllustration = () => ( + <Illustration> + { glyphs.map( ( glyph, i ) => { + const x = 44 + ( i % 6 ) * 40; + const y = 24 + Math.floor( i / 6 ) * 40; + return ( + <g key={ i } transform={ `translate(${ x } ${ y })` }> + <rect + width="32" + height="32" + style={ r.sm } + fill={ surface } + stroke={ muted } + /> + <g + transform="translate(4 4)" + style={ { color: i === 3 ? brand : foreground } } + > + <Icon icon={ glyph } size={ 24 } /> + </g> + </g> + ); + } ) } + </Illustration> +); diff --git a/storybook/stories/design-system/intro-cards/illustration.tsx b/storybook/stories/design-system/intro-cards/illustration.tsx new file mode 100644 index 00000000000000..21e915428674dd --- /dev/null +++ b/storybook/stories/design-system/intro-cards/illustration.tsx @@ -0,0 +1,15 @@ +import styles from './style.module.scss'; +import { surfaceWeak } from './palette'; + +export const Illustration = ( { children }: { children: React.ReactNode } ) => ( + <svg + viewBox="0 0 320 160" + preserveAspectRatio="xMidYMid slice" + className={ styles.illustration } + aria-hidden="true" + focusable="false" + > + <rect width="320" height="160" fill={ surfaceWeak } /> + { children } + </svg> +); diff --git a/storybook/stories/design-system/intro-cards/index.ts b/storybook/stories/design-system/intro-cards/index.ts new file mode 100644 index 00000000000000..9dd42659a16043 --- /dev/null +++ b/storybook/stories/design-system/intro-cards/index.ts @@ -0,0 +1,4 @@ +export { PackageCard } from './package-card'; +export { PackageCards } from './package-cards'; +export { PrincipleCard } from './principle-card'; +export { PrincipleCards } from './principle-cards'; diff --git a/storybook/stories/design-system/intro-cards/package-card.tsx b/storybook/stories/design-system/intro-cards/package-card.tsx new file mode 100644 index 00000000000000..08f5fb3c63cdde --- /dev/null +++ b/storybook/stories/design-system/intro-cards/package-card.tsx @@ -0,0 +1,66 @@ +import { Card, Link, Stack, Text } from '@wordpress/ui'; +import { AdminUIIllustration } from './admin-ui-illustration'; +import { ComponentsIllustration } from './components-illustration'; +import { DataViewsIllustration } from './dataviews-illustration'; +import { IconsIllustration } from './icons-illustration'; +import { ThemingIllustration } from './theming-illustration'; +import styles from './style.module.scss'; + +const illustrations = { + theming: ThemingIllustration, + components: ComponentsIllustration, + icons: IconsIllustration, + dataviews: DataViewsIllustration, + adminui: AdminUIIllustration, +}; + +export const PackageCard = ( { + illustration, + title, + packageName, + children, + storybookId, + docsHref, +}: { + illustration: keyof typeof illustrations; + title: string; + packageName: string; + children: React.ReactNode; + storybookId: string; + docsHref: string; +} ) => { + const Art = illustrations[ illustration ]; + return ( + <Card.Root className={ `sb-unstyled ${ styles.card }` }> + <Card.Content> + <Card.FullBleed> + <Art /> + </Card.FullBleed> + </Card.Content> + <Card.Content className={ styles.body }> + <Stack direction="column" gap="md"> + <Stack direction="column" gap="xs"> + <Text variant="heading-lg" render={ <h4 /> }> + { title } + </Text> + <Text variant="body-sm" render={ <code /> }> + { packageName } + </Text> + </Stack> + <Text variant="body-md" render={ <p /> }> + { children } + </Text> + <Stack direction="row" gap="lg" wrap="wrap"> + <Link + href={ `./?path=/docs/${ storybookId }` } + target="_top" + > + Learn more about { title } + </Link> + <Link href={ docsHref }>Developer documentation</Link> + </Stack> + </Stack> + </Card.Content> + </Card.Root> + ); +}; diff --git a/storybook/stories/design-system/intro-cards/package-cards.tsx b/storybook/stories/design-system/intro-cards/package-cards.tsx new file mode 100644 index 00000000000000..fabfe3be164fef --- /dev/null +++ b/storybook/stories/design-system/intro-cards/package-cards.tsx @@ -0,0 +1,13 @@ +import { Stack } from '@wordpress/ui'; +import styles from './style.module.scss'; + +export const PackageCards = ( { children }: { children: React.ReactNode } ) => ( + <Stack + direction="row" + gap="lg" + wrap="wrap" + className={ styles[ 'card-group' ] } + > + { children } + </Stack> +); diff --git a/storybook/stories/design-system/intro-cards/palette.ts b/storybook/stories/design-system/intro-cards/palette.ts new file mode 100644 index 00000000000000..6a5e8cea210bd8 --- /dev/null +++ b/storybook/stories/design-system/intro-cards/palette.ts @@ -0,0 +1,16 @@ +export const brand = 'var(--wpds-color-background-interactive-brand-strong)'; +export const neutral = 'var(--wpds-color-background-interactive-neutral)'; +export const surface = 'var(--wpds-color-background-surface-neutral-strong)'; +export const surfaceWeak = 'var(--wpds-color-background-surface-neutral-weak)'; +export const foreground = 'var(--wpds-color-foreground-content-neutral)'; +export const stroke = 'var(--wpds-color-stroke-surface-neutral)'; +export const muted = 'var(--wpds-color-stroke-surface-neutral-weak)'; + +// Corner radii follow the tokens used by the real components: `sm` for +// buttons, inputs and tiles, `xs` for checkboxes, `lg` for cards and panels. +const radius = ( value: string ) => ( { rx: value } ) as React.CSSProperties; +export const r = { + xs: radius( 'min(var(--wpds-border-radius-sm), 2px)' ), + sm: radius( 'var(--wpds-border-radius-sm)' ), + lg: radius( 'var(--wpds-border-radius-lg)' ), +}; diff --git a/storybook/stories/design-system/principle-cards.tsx b/storybook/stories/design-system/intro-cards/principle-card.tsx similarity index 65% rename from storybook/stories/design-system/principle-cards.tsx rename to storybook/stories/design-system/intro-cards/principle-card.tsx index 53acff0ece2d6f..a3bea429335147 100644 --- a/storybook/stories/design-system/principle-cards.tsx +++ b/storybook/stories/design-system/intro-cards/principle-card.tsx @@ -1,5 +1,5 @@ import { Card, Stack, Text } from '@wordpress/ui'; -import styles from './package-cards.module.scss'; +import styles from './style.module.scss'; export const PrincipleCard = ( { title, @@ -21,18 +21,3 @@ export const PrincipleCard = ( { </Card.Content> </Card.Root> ); - -export const PrincipleCards = ( { - children, -}: { - children: React.ReactNode; -} ) => ( - <Stack - direction="row" - gap="lg" - wrap="wrap" - className={ styles[ 'card-group' ] } - > - { children } - </Stack> -); diff --git a/storybook/stories/design-system/intro-cards/principle-cards.tsx b/storybook/stories/design-system/intro-cards/principle-cards.tsx new file mode 100644 index 00000000000000..452632dc3f4670 --- /dev/null +++ b/storybook/stories/design-system/intro-cards/principle-cards.tsx @@ -0,0 +1,17 @@ +import { Stack } from '@wordpress/ui'; +import styles from './style.module.scss'; + +export const PrincipleCards = ( { + children, +}: { + children: React.ReactNode; +} ) => ( + <Stack + direction="row" + gap="lg" + wrap="wrap" + className={ styles[ 'card-group' ] } + > + { children } + </Stack> +); diff --git a/storybook/stories/design-system/package-cards.module.scss b/storybook/stories/design-system/intro-cards/style.module.scss similarity index 100% rename from storybook/stories/design-system/package-cards.module.scss rename to storybook/stories/design-system/intro-cards/style.module.scss diff --git a/storybook/stories/design-system/intro-cards/theming-illustration.tsx b/storybook/stories/design-system/intro-cards/theming-illustration.tsx new file mode 100644 index 00000000000000..c1b5c7a483d272 --- /dev/null +++ b/storybook/stories/design-system/intro-cards/theming-illustration.tsx @@ -0,0 +1,32 @@ +import { Illustration } from './illustration'; +import { brand, r } from './palette'; + +/** Color swatches in a ramp, above a row of token-like bars. */ +export const ThemingIllustration = () => ( + <Illustration> + { [ 0.2, 0.4, 0.6, 0.8, 1 ].map( ( o, i ) => ( + <rect + key={ i } + x={ 40 + i * 48 } + y={ 36 } + width="40" + height="56" + style={ r.lg } + fill={ brand } + opacity={ o } + /> + ) ) } + { [ 0.2, 0.4, 0.6, 0.8, 1 ].map( ( o, i ) => ( + <rect + key={ i } + x={ 40 + i * 48 } + y={ 104 } + width="40" + height="6" + rx="3" + fill={ brand } + opacity={ o } + /> + ) ) } + </Illustration> +); diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index 26e8619962fe3f..9c40ffa186802b 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -1,6 +1,10 @@ import { Meta } from '@storybook/addon-docs/blocks'; -import { PackageCard, PackageCards } from './package-cards'; -import { PrincipleCard, PrincipleCards } from './principle-cards'; +import { + PackageCard, + PackageCards, + PrincipleCard, + PrincipleCards, +} from './intro-cards'; <Meta title="Design System/Introduction" /> diff --git a/storybook/stories/design-system/package-cards.tsx b/storybook/stories/design-system/package-cards.tsx deleted file mode 100644 index a735b45e674620..00000000000000 --- a/storybook/stories/design-system/package-cards.tsx +++ /dev/null @@ -1,421 +0,0 @@ -import { - Icon, - bell, - calendar, - check, - cog, - comment, - globe, - home, - image, - link as linkIcon, - lock, - media, - page, - pencil, - plus, - search, - starFilled, - tag, - trash, -} from '@wordpress/icons'; -import { Card, Link, Stack, Text } from '@wordpress/ui'; -import styles from './package-cards.module.scss'; - -const brand = 'var(--wpds-color-background-interactive-brand-strong)'; -const neutral = 'var(--wpds-color-background-interactive-neutral)'; -const surface = 'var(--wpds-color-background-surface-neutral-strong)'; -const surfaceWeak = 'var(--wpds-color-background-surface-neutral-weak)'; -const foreground = 'var(--wpds-color-foreground-content-neutral)'; -const stroke = 'var(--wpds-color-stroke-surface-neutral)'; -const muted = 'var(--wpds-color-stroke-surface-neutral-weak)'; - -// Corner radii follow the tokens used by the real components: `sm` for -// buttons, inputs and tiles, `xs` for checkboxes, `lg` for cards and panels. -const radius = ( value: string ) => ( { rx: value } ) as React.CSSProperties; -const r = { - xs: radius( 'min(var(--wpds-border-radius-sm), 2px)' ), - sm: radius( 'var(--wpds-border-radius-sm)' ), - lg: radius( 'var(--wpds-border-radius-lg)' ), -}; - -const Illustration = ( { children }: { children: React.ReactNode } ) => ( - <svg - viewBox="0 0 320 160" - preserveAspectRatio="xMidYMid slice" - className={ styles.illustration } - aria-hidden="true" - focusable="false" - > - <rect width="320" height="160" fill={ surfaceWeak } /> - { children } - </svg> -); - -/** Color swatches in a ramp, above a row of token-like bars. */ -const ThemingIllustration = () => ( - <Illustration> - { [ 0.2, 0.4, 0.6, 0.8, 1 ].map( ( o, i ) => ( - <rect - key={ i } - x={ 40 + i * 48 } - y={ 36 } - width="40" - height="56" - style={ r.lg } - fill={ brand } - opacity={ o } - /> - ) ) } - { [ 0.2, 0.4, 0.6, 0.8, 1 ].map( ( o, i ) => ( - <rect - key={ i } - x={ 40 + i * 48 } - y={ 104 } - width="40" - height="6" - rx="3" - fill={ brand } - opacity={ o } - /> - ) ) } - </Illustration> -); - -/** A button, a text field, a toggle and a checkbox. */ -const ComponentsIllustration = () => ( - <Illustration> - <rect - x="40" - y="32" - width="96" - height="32" - style={ r.sm } - fill={ brand } - /> - <rect - x="148" - y="32" - width="96" - height="32" - style={ r.sm } - fill={ surface } - stroke={ stroke } - /> - <rect - x="160" - y="45" - width="72" - height="6" - rx="3" - fill={ neutral } - opacity="0.5" - /> - <rect - x="40" - y="80" - width="204" - height="32" - style={ r.sm } - fill={ surface } - stroke={ stroke } - /> - <rect - x="52" - y="93" - width="80" - height="6" - rx="3" - fill={ neutral } - opacity="0.5" - /> - <rect x="256" y="40" width="32" height="18" rx="9" fill={ brand } /> - <circle cx="279" cy="49" r="6" fill={ surface } /> - <rect - x="256" - y="86" - width="20" - height="20" - style={ r.xs } - fill={ brand } - /> - <path - d="M261 96l4 4 7-8" - fill="none" - stroke={ surface } - strokeWidth="2.5" - strokeLinecap="round" - strokeLinejoin="round" - /> - </Illustration> -); - -const glyphs = [ - pencil, - plus, - trash, - cog, - image, - page, - home, - search, - starFilled, - check, - comment, - linkIcon, - tag, - calendar, - lock, - media, - bell, - globe, -]; - -/** A grid of real icons from the library. */ -const IconsIllustration = () => ( - <Illustration> - { glyphs.map( ( glyph, i ) => { - const x = 44 + ( i % 6 ) * 40; - const y = 24 + Math.floor( i / 6 ) * 40; - return ( - <g key={ i } transform={ `translate(${ x } ${ y })` }> - <rect - width="32" - height="32" - style={ r.sm } - fill={ surface } - stroke={ muted } - /> - <g - transform="translate(4 4)" - style={ { color: i === 3 ? brand : foreground } } - > - <Icon icon={ glyph } size={ 24 } /> - </g> - </g> - ); - } ) } - </Illustration> -); - -/** A table with a filter bar and selectable rows. */ -const DataViewsIllustration = () => ( - <Illustration> - <rect - x="40" - y="24" - width="240" - height="112" - style={ r.lg } - fill={ surface } - stroke={ stroke } - /> - <rect - x="52" - y="36" - width="64" - height="14" - style={ r.sm } - fill={ surface } - stroke={ stroke } - /> - <rect - x="124" - y="36" - width="40" - height="14" - style={ r.sm } - fill={ brand } - /> - { [ 0, 1, 2, 3 ].map( ( i ) => { - const top = 62 + i * 18; - return ( - <g key={ i }> - <line - x1="40" - x2="280" - y1={ top } - y2={ top } - stroke={ muted } - /> - <rect - x="52" - y={ top + 5 } - width="8" - height="8" - style={ r.xs } - fill={ i === 1 ? brand : 'none' } - stroke={ i === 1 ? brand : stroke } - /> - <rect - x="74" - y={ top + 6 } - width={ 70 + ( ( i * 23 ) % 40 ) } - height="6" - rx="3" - fill={ neutral } - opacity="0.5" - /> - <rect - x="200" - y={ top + 6 } - width="60" - height="6" - rx="3" - fill={ neutral } - opacity="0.25" - /> - </g> - ); - } ) } - </Illustration> -); - -/** A page frame: full-height sidebar, header with one primary action, content. */ -const AdminUIIllustration = () => ( - <Illustration> - <clipPath id="package-cards-admin-ui-frame"> - <rect x="40" y="20" width="240" height="120" style={ r.lg } /> - </clipPath> - <rect - x="40" - y="20" - width="240" - height="120" - style={ r.lg } - fill={ surface } - /> - <g clipPath="url(#package-cards-admin-ui-frame)"> - <rect x="40" y="20" width="60" height="120" fill={ surfaceWeak } /> - </g> - <line x1="100" x2="100" y1="20" y2="140" stroke={ muted } /> - <line x1="100" x2="280" y1="46" y2="46" stroke={ muted } /> - <rect x="52" y="30" width="24" height="8" rx="4" fill={ neutral } /> - { [ 0, 1, 2, 3 ].map( ( i ) => ( - <rect - key={ i } - x="52" - y={ 58 + i * 18 } - width="36" - height="6" - rx="3" - fill={ neutral } - opacity={ i === 0 ? 0.7 : 0.35 } - /> - ) ) } - <rect - x="112" - y="30" - width="56" - height="8" - rx="4" - fill={ neutral } - opacity="0.6" - /> - <rect - x="244" - y="28" - width="24" - height="12" - style={ r.sm } - fill={ brand } - /> - <rect - x="112" - y="58" - width="156" - height="28" - style={ r.sm } - fill={ surfaceWeak } - /> - <rect - x="112" - y="96" - width="156" - height="32" - style={ r.sm } - fill={ surfaceWeak } - /> - <rect - x="40" - y="20" - width="240" - height="120" - style={ r.lg } - fill="none" - stroke={ stroke } - /> - </Illustration> -); - -const illustrations = { - theming: ThemingIllustration, - components: ComponentsIllustration, - icons: IconsIllustration, - dataviews: DataViewsIllustration, - adminui: AdminUIIllustration, -}; - -export const PackageCard = ( { - illustration, - title, - packageName, - children, - storybookId, - docsHref, -}: { - illustration: keyof typeof illustrations; - title: string; - packageName: string; - children: React.ReactNode; - storybookId: string; - docsHref: string; -} ) => { - const Art = illustrations[ illustration ]; - return ( - <Card.Root className={ `sb-unstyled ${ styles.card }` }> - <Card.Content> - <Card.FullBleed> - <Art /> - </Card.FullBleed> - </Card.Content> - <Card.Content className={ styles.body }> - <Stack direction="column" gap="md"> - <Stack direction="column" gap="xs"> - <Text variant="heading-lg" render={ <h4 /> }> - { title } - </Text> - <Text variant="body-sm" render={ <code /> }> - { packageName } - </Text> - </Stack> - <Text variant="body-md" render={ <p /> }> - { children } - </Text> - <Stack direction="row" gap="lg" wrap="wrap"> - <Link - href={ `./?path=/docs/${ storybookId }` } - target="_top" - > - Learn more about { title } - </Link> - <Link href={ docsHref }> - Developer documentation - </Link> - </Stack> - </Stack> - </Card.Content> - </Card.Root> - ); -}; - -export const PackageCards = ( { children }: { children: React.ReactNode } ) => ( - <Stack - direction="row" - gap="lg" - wrap="wrap" - className={ styles[ 'card-group' ] } - > - { children } - </Stack> -); From 1b9e852292ce167b90662cf97a2bc2c811041ca6 Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:20:53 +0200 Subject: [PATCH 10/14] Storybook: Explain the two levels of the design system in the introduction Describe foundational packages as primitives for custom interfaces and compositional packages as complete experiences built from them. --- storybook/stories/design-system/introduction.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index 9c40ffa186802b..5fcaa671748a6d 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -16,7 +16,7 @@ It is what WordPress itself is built with, and it is available to plugin develop ## Build with the Design System -Use [Admin UI](?path=/docs/admin-ui-page--docs), [DataViews](?path=/docs/dataviews-dataviews--docs) and [DataForm](?path=/docs/dataviews-dataform--docs) to build new table and form based interfaces. Use the [components](?path=/docs/design-system-components-introduction--docs) to build completely new custom interfaces. +The design system has two levels. Foundational packages provide the primitives: [components](?path=/docs/design-system-components-introduction--docs), [icons](?path=/docs/icons-icon--docs) and [design tokens](?path=/docs/design-system-theme-introduction--docs), for building custom interfaces with full control. Compositional packages combine those primitives into complete experiences: use [Admin UI](?path=/docs/admin-ui-page--docs), [DataViews](?path=/docs/dataviews-dataviews--docs) and [DataForm](?path=/docs/dataviews-dataform--docs) to build table and form based interfaces quickly and consistently. When building your own components, use [design tokens](https://github.com/WordPress/gutenberg/blob/trunk/packages/theme/docs/tokens.md) as part of your component styles to stay aligned with the design system's own components. The [theming system](?path=/docs/design-system-theme-introduction--docs) provides them as custom CSS properties that you can use in your own stylesheet. From fd1412235e287ea17b579986e6b507370316f807 Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:21:40 +0200 Subject: [PATCH 11/14] Storybook: Make the package documentation link text descriptive Use "Read the <title> package documentation" so it is clear where the link goes and how it differs from the Storybook link. --- storybook/stories/design-system/intro-cards/package-card.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storybook/stories/design-system/intro-cards/package-card.tsx b/storybook/stories/design-system/intro-cards/package-card.tsx index 08f5fb3c63cdde..0daa7f6b1c3b1b 100644 --- a/storybook/stories/design-system/intro-cards/package-card.tsx +++ b/storybook/stories/design-system/intro-cards/package-card.tsx @@ -57,7 +57,9 @@ export const PackageCard = ( { > Learn more about { title } </Link> - <Link href={ docsHref }>Developer documentation</Link> + <Link href={ docsHref }> + Read the { title } package documentation + </Link> </Stack> </Stack> </Card.Content> From 157c5946a70f1d81dd97d902eea53ccf4c5a1cca Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:32:40 +0200 Subject: [PATCH 12/14] Lead with foundational packages (components, icons, tokens) before compositional packages (dataviews/forms/admin-ui) --- storybook/stories/design-system/introduction.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index 5fcaa671748a6d..2d8a586b41b01b 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -16,9 +16,11 @@ It is what WordPress itself is built with, and it is available to plugin develop ## Build with the Design System -The design system has two levels. Foundational packages provide the primitives: [components](?path=/docs/design-system-components-introduction--docs), [icons](?path=/docs/icons-icon--docs) and [design tokens](?path=/docs/design-system-theme-introduction--docs), for building custom interfaces with full control. Compositional packages combine those primitives into complete experiences: use [Admin UI](?path=/docs/admin-ui-page--docs), [DataViews](?path=/docs/dataviews-dataviews--docs) and [DataForm](?path=/docs/dataviews-dataform--docs) to build table and form based interfaces quickly and consistently. +Foundational packages provide the primitives for building any interface: [components](?path=/docs/design-system-components-introduction--docs), [icons](?path=/docs/icons-icon--docs) and [design tokens](?path=/docs/design-system-theme-introduction--docs). -When building your own components, use [design tokens](https://github.com/WordPress/gutenberg/blob/trunk/packages/theme/docs/tokens.md) as part of your component styles to stay aligned with the design system's own components. The [theming system](?path=/docs/design-system-theme-introduction--docs) provides them as custom CSS properties that you can use in your own stylesheet. +Compositional packages combine those primitives into complete experiences. Use [Admin UI](?path=/docs/admin-ui-page--docs), [DataViews](?path=/docs/dataviews-dataviews--docs) and [DataForm](?path=/docs/dataviews-dataform--docs) to build table and form based interfaces quickly and consistently. + +When building your own components, use [design tokens](https://github.com/WordPress/gutenberg/blob/trunk/packages/theme/docs/tokens.md) in your component styles to stay aligned with the design system's own components. The [theming system](?path=/docs/design-system-theme-introduction--docs) exposes these tokens as custom CSS properties you can use in your own stylesheet. When working with AI agents, use the [WordPress Design System MCP Server](?path=/docs/design-system-using-with-ai--docs). It gives agents the latest component documentation, usage examples, and design tokens. From 2f28ba12f929b3feefed1e6781337a81fd54b2a6 Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:55:43 +0200 Subject: [PATCH 13/14] Storybook: Match package card link size to the body text Render the link row through Text so the links use the body-md size instead of inheriting the larger docs font size. --- .../stories/design-system/intro-cards/package-card.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/storybook/stories/design-system/intro-cards/package-card.tsx b/storybook/stories/design-system/intro-cards/package-card.tsx index 0daa7f6b1c3b1b..b0fcb57c845a6d 100644 --- a/storybook/stories/design-system/intro-cards/package-card.tsx +++ b/storybook/stories/design-system/intro-cards/package-card.tsx @@ -50,7 +50,12 @@ export const PackageCard = ( { <Text variant="body-md" render={ <p /> }> { children } </Text> - <Stack direction="row" gap="lg" wrap="wrap"> + <Text + variant="body-md" + render={ + <Stack direction="row" gap="lg" wrap="wrap" /> + } + > <Link href={ `./?path=/docs/${ storybookId }` } target="_top" @@ -60,7 +65,7 @@ export const PackageCard = ( { <Link href={ docsHref }> Read the { title } package documentation </Link> - </Stack> + </Text> </Stack> </Card.Content> </Card.Root> From 1b4a7adeed350d681935f47fc0afa4654849546c Mon Sep 17 00:00:00 2001 From: Mikael Korpela <mikael@ihminen.org> Date: Tue, 24 Nov 2026 13:57:37 +0200 Subject: [PATCH 14/14] Storybook: Link DataForm from the DataViews card --- storybook/stories/design-system/introduction.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storybook/stories/design-system/introduction.mdx b/storybook/stories/design-system/introduction.mdx index 2d8a586b41b01b..917da0bd28bf34 100644 --- a/storybook/stories/design-system/introduction.mdx +++ b/storybook/stories/design-system/introduction.mdx @@ -74,7 +74,7 @@ Higher-level compositional packages use the design system to provide solutions f storybookId="dataviews-dataviews--docs" docsHref="https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dataviews/" > - Display, filter and edit lists of data as a table, grid or list, with DataForm for editing individual records. + Display, filter and edit lists of data as a table, grid or list, with [DataForm](?path=/docs/dataviews-dataform--docs) for editing individual records. </PackageCard> <PackageCard illustration="adminui"