logoNamu Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
1.0.0
  • Components Overview
  • General
    • Button
    • FloatButtonNew
    • Icon
    • Typography
  • Layout
    • Divider
    • Grid
    • Layout
    • Space
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPickerNew
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCodeNew
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • TourNew
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • AppNew
    • ConfigProvider
When To Use
Examples
Type
Icon
Size
Disabled
Loading
Multiple Buttons
Ghost Button
Danger Buttons
Block Button
API
styles and classNames attribute
Design Token
FAQ
How to remove space between 2 chinese characters?

Button

  • Components OverviewFloatButton

    Resources

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

    Community

    Awesome Namu Design
    Medium
    Twitter
    yuqueNamu Design in YuQue
    Namu Design in Zhihu
    Experience Cloud Blog
    seeconfSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTechMore Products

    yuqueYuQue-Document Collaboration Platform
    AntVAntV-Data Visualization
    EggEgg-Enterprise Node.js Framework
    kitchenKitchen-Sketch Toolkit
    xtechAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Namu Design Community

    To trigger an operation.

    When To Use

    A button means an operation (or a series of operations). Clicking a button will trigger corresponding business logic.

    In Namu Design we provide 5 types of button.

    • Primary button: indicate the main action, one primary button at most in one section.
    • Default button: indicate a series of actions without priority.
    • Dashed button: used for adding action commonly.
    • Text button: used for the most secondary action.
    • Link button: used for external links.

    And 4 other properties additionally.

    • danger: used for actions of risk, like deletion or authorization.
    • ghost: used in situations with complex background, home pages usually.
    • disabled: when actions are not available.
    • loading: add loading spinner in button, avoiding multiple submits too.

    Examples

    Type

    There are primary button, default button, dashed button, text button and link button in antd.

    expand codeexpand code
    Size

    Namu Design supports a default button size as well as a large and small size.

    If a large or small button is desired, set the size property to either large or small respectively. Omit the size property for a button with the default size.

    expand codeexpand code
    Loading

    A loading indicator can be added to a button by setting the loading property on the Button.

    expand codeexpand code
    Ghost Button

    ghost property will make button's background transparent, it is commonly used in colored background.

    expand codeexpand code
    Block Button

    block property will make the button fit to its parent width.

    expand codeexpand code
    Icon

    Button components can contain an Icon. This is done by setting the icon property or placing an Icon component within the Button.

    If you want specific control over the positioning and placement of the Icon, then that should be done by placing the Icon component within the Button rather than using the icon property.

    expand codeexpand code
    Disabled

    To mark a button as disabled, add the disabled property to the Button.

    expand codeexpand code
    Multiple Buttons

    If you need several buttons, we recommend that you use 1 primary button + n secondary buttons, and if there are more than three operations, you can group some of them into Dropdown.Button.

    expand codeexpand code
    Danger Buttons

    danger is a property of button after antd 4.0.

    expand codeexpand code

    API

    Common props ref:Common props

    Different button styles can be generated by setting Button properties. The recommended order is: type -> shape -> size -> loading -> disabled.

    PropertyDescriptionTypeDefaultVersion
    blockOption to fit button width to its parent widthbooleanfalse
    classNamesSemantic DOM classRecord<SemanticDOM, string>-5.4.0
    dangerSet the danger status of buttonbooleanfalse
    disabledDisabled state of buttonbooleanfalse
    ghostMake background transparent and invert text and border colorsbooleanfalse
    hrefRedirect url of link buttonstring-
    htmlTypeSet the original html type of button, see: MDNstringbutton
    iconSet the icon component of buttonReactNode-
    loadingSet the loading status of buttonboolean | { delay: number }false
    shapeCan be set button shapedefault | circle | rounddefault
    sizeSet the size of buttonlarge | middle | smallmiddle
    stylesSemantic DOM styleRecord<SemanticDOM, CSSProperties>-5.4.0
    targetSame as target attribute of a, works when href is specifiedstring-
    typeSet button typeprimary | dashed | link | text | defaultdefault
    onClickSet the handler to handle click event(event: MouseEvent) => void-

    It accepts all props which native buttons support.

    styles and classNames attribute

    PropertyDescriptionVersion
    iconset iconelement5.5.0

    Design Token

    Global Token

    FAQ

    How to remove space between 2 chinese characters?

    Following the Namu Design specification, we will add one space between if Button (exclude Text button and Link button) contains two Chinese characters only. If you don't need that, you can use ConfigProvider to set autoInsertSpaceInButton as false.

    Button with two Chinese characters
    Preview
    Href Primary
    Href Primary(disabled)