logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
6.3.3
  • Discover the Delicate Beauty of Components with Semantic Design
  • CSS in v6
  • 👀 Visual Regression Testing
  • Why is it so hard to disable the date?
  • HOC Aggregate FieldItem
  • Line Ellipsis Calculation
  • 📢 v4 surpassed maintenance period
  • Type Util
  • A build ghost
  • Ant Design meets CSS Variables
  • Historical Debt of API
  • Stacked Notification
  • Color Models and Color Picker
  • Extends Theme
  • Virtual Table is here!
  • Happy Work Theme
  • Where is the dynamic style?
  • Suspense breaks styles
  • Bundle Size Optimization
  • Hi, GitHub Actions
  • To be what you see
  • Pain of static methods
  • SSR Static style export
  • Dependency troubleshooting
  • Contributor development maintenance guide
  • Repost: How to submit a riddle
  • Tooltip align update
  • Unnecessary Rerender
  • How to Grow as a Collaborator
  • Funny Modal hook BUG
  • about antd test library migration
  • Tree's check conduction
  • Some change on getContainer
  • Component-level CSS-in-JS
Before v6
Method 1 (props)
Method 2 (ConfigProvider)
Method 3 (CSS)
Now in v6
Combining with Tailwind CSS
Discover the Delicate Beauty of Components
The Relationship Between Tokens and Semantic Styling

Discover the Delicate Beauty of Components with Semantic Design

2025-11-22
@meet-student
@thinkasany
contributors
    CSS in v6

    Resources

    Ant Design X
    Ant Design Charts
    Ant Design Pro
    Pro Components
    Ant Design Mobile
    Ant Design Mini
    Ant Design Web3
    Ant Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Ant Design
    Medium
    X
    yuque logoAnt Design in YuQue
    Ant Design in Zhihu
    Experience Cloud Blog
    seeconf logoSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTech logoMore Products

    yuque logoYuQue-Document Collaboration Platform
    AntV logoAntV-Data Visualization
    Egg logoEgg-Enterprise Node.js Framework
    Kitchen logoKitchen-Sketch Toolkit
    Galacean logoGalacean-Interactive Graphics Solution
    WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
    xtech logoAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Ant Design Community
    loading

    Before Ant Design v6, the experience of customizing styles based on open tokens was already great, but there were still some pain points that were difficult to solve. Ant Design v6 made many changes and improvements to address this. Today, let’s talk about how semantic design helps you discover the delicate beauty of components.


    Before v6

    In the past, how did we typically adjust component styles?

    Method 1 (props)

    • Write extensive conditional logic for combinations in className and style attributes
    • Use numerous props like wrapClassName when modifying styles of different component regions

    The code might look like this:

    tsx
    <Button className={variant === 'filled' ? 'btn-filled' : 'btn-outline'}>
    Submit
    </Button>
    <Modal wrapClassName="wrap-class" style={{ backgroundColor: '#fff' }}>
    Modal
    </Modal>
    <Menu style={{ backgroundColor: mode === 'horizontal' ? '#fff' : '#000' }}>
    <Menu.SubMenu popupClassName="popup-class">
    <Menu.Item >
    MenuItem
    </Menu.Item>
    </Menu.SubMenu>
    </Menu>

    Method 2 (ConfigProvider)

    Using the theme Design Token design introduced in Ant Design v5:

    tsx
    <ConfigProvider
    theme={{
    components: {
    Notification: {
    colorTextHeading: token.blue,
    colorText: token.colorTextSecondary,
    },
    },
    }}
    >
    {children}
    </ConfigProvider>

    Method 3 (CSS)

    Apart from these two methods, you might also have written less recommended CSS overrides:

    css
    .wrapper-class .ant-table {
    border-radius: 4px;
    overflow: hidden;
    }
    .wrapper-class .ant-table .ant-table-thead {
    background-color: #f9fafc;
    color: #8b97b6;
    }

    All of the above approaches have various pain points:

    • Limited available props make it impossible to modify certain regions, and logic is not well-organized
    • Limited Design Token configuration prevents differentiated styling based on different types/variants
    • CSS overrides introduce high cognitive load and maintenance costs, with poor maintainability and semantics

    Now in v6

    To avoid token proliferation and the addition of numerous API props — which would increase maintenance costs — these elements were consolidated into a more semantic structure.

    • The DOM structure has been greatly simplified and refined.
    • Styles and themes can now be customized more flexibly and in a more maintainable way based on different props.
    • It’s possible to define styles or class names for specific semantic regions, making it easier to customize local styles or themes.
    tsx
    const classNamesFn: ButtonProps['classNames'] = (info) => {
    if (info.props.type === 'primary') {
    return {
    root: 'demo-btn-root--primary',
    } satisfies ButtonProps['classNames'];
    }
    return {
    root: 'demo-btn-root--default',
    } satisfies ButtonProps['classNames'];
    };
    const styles: ButtonProps['styles'] = {
    root: { borderWidth: 2, borderStyle: 'dashed' },
    content: { fontStyle: 'italic' },
    icon: { opacity: 0.85 },
    };
    return (
    <Button styles={styles} classNames={classNamesFn}>
    Button
    </Button>
    );

    Combining with Tailwind CSS

    What's more exciting is that the classNames property integrates perfectly with atomic CSS frameworks like Tailwind CSS. This provides developers with unprecedented freedom: you can enjoy the preset behavior and semantic structure of antd components while leveraging Tailwind's utility classes to quickly build any visual style you want. Semantic design + Tailwind CSS, makes component customization extremely flexible.

    tsx
    return (
    <Button
    classNames={{
    root: 'bg-black text-white border-none hover:bg-[#2e2e2e]',
    icon: 'text-white/90',
    }}
    icon={<GiftOutlined />}
    >
    Ant Design
    </Button>
    );

    Discover the Delicate Beauty of Components

    Users can give components refined designs for different states based on their preferred color schemes. Let your imagination run wild and make your pages more vibrant and expressive. If you encounter any issues or have better ideas during use, feel free to share feedback — let’s make Ant Design even better together.


    The Relationship Between Tokens and Semantic Styling

    In Ant Design’s design system, tokens are positioned as design variables — the atomic materials of the design language. Semantic styles, on the other hand, define how those materials are used. They are created by combining design tokens with component-level customizations, allowing for more flexible and expressive styling scenarios. Since semantic styles operate at the component level, they provide better control over styling scope. If you aim to design a fully customized Ant Design theme, the combination of tokens and semantic styling will be your most powerful tool — together, they enable you to craft a more refined and precisely tailored theme.