My Docs
DeploymentTrelloCalendar 🗓 Family Promise Roadmap
LAMBDA_LABS_Family_Promise
LAMBDA_LABS_Family_Promise
  • Home
  • navigation
    • Resume
    • My Notes:
    • NAVIGATION
    • Calendar
    • Youtube:
    • Roadmap:
    • TEAM MEMBERS
    • Running List Of Notes Links & Pertinent Info From Meetings
    • Trello
      • Github/Trello Integration
  • UX
    • UX_TOPICS
      • Action Items:
      • Accessibility
      • Figma Notes
        • Tables In Figma
        • Notes
        • Frames in Figma
        • Prototyping In Figma
        • More Notes
      • UX-Design
        • Facebook Graph API
      • Ant Design
        • ANT Components
          • Buttons
        • ANT DOCS
        • Application (Codesandbox)
      • Examples
      • How to add external URL links to your prototype
  • CANVAS
    • Interview
    • Design
      • What's Inclusive Design?
      • Accessibility
      • What are Design Systems?
    • Canvas
      • Career Readiness:
    • Notes
      • User Experience Design
      • User Research
      • Interaction Design
    • UX-Engineer
      • Accessibility
      • Patterns
      • Design Tools
      • UX Principles
      • Design Critiques
      • Product Review
      • Quiz
      • Seven Principles of Design
      • Other Articles
    • Labs
  • Front End
    • Frontend:
    • Redux
  • Back End
    • Backend:
      • API
  • Research
    • Research Navigation
      • Front End
      • Back End
      • UX
      • PTM
      • General
  • DS_API
    • Data Science API
  • ROLES
    • TEAM ROLES
      • Bryan Guner
  • Action Items
    • Trello
    • Maps
  • ARCHITECTURE
    • DNS
    • AWS
    • Heroku
  • Questions
    • From Previous Cohort
  • Standup Notes
    • Meeting Notes
      • Stakeholder Meeting 1
      • 9/29/2021
  • GitHub & Project Practice
    • GitHub
      • Github Guide
      • Github Actions:
      • Live Implementation
  • MISC
    • MISCELLANEOUS
      • Links
  • Background Information
    • Background Info
      • Swagger OPEN API SPECIFICATION
        • Swagger Docs (General)
      • GITHUB:
        • Git Bash
        • Git Prune:
  • DOCS
    • DS AP
    • What is JSON Web Token?
      • Environment Variables
      • Git Rebase:
      • Git Workflow:
      • Linting and Formatting
    • Project Docs
      • Eng-Docs-Home
      • Basic Node API
      • Contributing to this scaffold project
      • Examples:
    • PROJECT DESCRIPTION (Feature List)
    • Labs Learners Guide
    • REACT
      • Create React App
      • Awesome React
    • Labs Engineering Docs
      • Okta Basics
      • Roadmap
      • Repositories
  • Workflow
    • Workflow
    • Advice
  • AWS
    • AWS
      • Elastic Beanstalk
        • Elastic Beanstalk DNS
      • Amplify:
        • Amplify-DNS
    • Account Basics
    • AWS-Networking
  • Career & Job Hunt
    • Career
  • LABS
    • Introduction
    • User Stories
    • Why Pairing?
    • GitHub
    • Planning as an Engineer
    • Authentication and Authorization
      • Authentication VS Authorization
    • Giving Feedback
    • Modules Grades Understanding Your ISA
    • Rest Architecture
Powered by GitBook
On this page
  • Forms
  • Components Overview
  • General3
  • Layout4
  • Navigation7
  • Data Entry17
  • Data Display19
  • Feedback10
  • Other3

Was this helpful?

  1. UX
  2. UX_TOPICS
  3. Ant Design

ANT Components

PreviousAnt DesignNextButtons

Last updated 3 years ago

Was this helpful?

Forms

Example Form

  • Here's an example of building a basic form using our reusable FormInput & FormButton components. You can use these to build out different types of forms throughout your application:

import { FormInput, FormButton } from './components/common';<form onSubmit={handleSubmit}>  <FormInput placeholder="Email" name="email" labelId="User Email" />  <FormButton buttonText="Submit" classType="default" disabled="false" /></form>Copy
  • Note that we are importing our components from ./components/common. This is the directory where any of your custom reusable components should live.

Ant Design Form

  • Here's is an example of creating a basic form using Ant Design components:

import { Form, Input, Button } from 'antd';<Form onFinish={handleSubmit}>  <Form.Item    label="My Input"  >    <Input />  </Form.Item>  <Form.Item>    <Button type="primary" htmlType="submit">      Submit    </Button>  </Form.Item></Form>Copy
  • Note that each child component of the form needs to be wrapped in a Form.Item component for Ant Design's layout to work.

  • To customize the layout of our form we can create a layout object and make use of :

const layout = {   // This specifies how wide we want our form container (wrapper) to be,   // where a span of 24 is equivalent to 100%.    wrapperCol: {      span: 8,    }  };  // To use our layout we can spread our layout object on our Form component:  <Form onFinish={handleSubmit} {...layout}>  <Form.Item    label="My Input"  >    <Input />  </Form.Item>  <Form.Item>    <Button type="primary" htmlType="submit">      Submit    </Button>  </Form.Item></Form>Copy
  • You can also specify the grid layouts for each Form.Item component:

const itemLayout = {  wrapperCol: { offset: 4, span: 8 },}<Form onFinish={handleSubmit} {...layout}>  <Form.Item    label="My Input"  >    <Input />  </Form.Item>  <Form.Item {...itemLayout}>    <Button type="primary" htmlType="submit">      Submit    </Button>  </Form.Item></Form>Copy
  • Adding form validation with Ant Design is really simple! We can specify a rules array with an error type and the message we would like to display on that error:

const myRules = [  {    required: true,    message: 'Please input your email!',  },  {    type: 'email',    message: 'Please enter a valid email',  },];<Form onFinish={handleSubmit} {...layout}>  <Form.Item    label="Email"    name="email"    rules={myRules}  >    <Input />  </Form.Item>  <Form.Item {...itemLayout}>    <Button type="primary" htmlType="submit">      Submit    </Button>  </Form.Item></Form>Copy
  • Note that we have to add a name prop to our input in order for our validation rules to take effect.

  • For more detail on using the Ant Design Form component check out the .

Components Overview

General3

Layout4

Navigation7

Data Entry17

Data Display19

Feedback10

Other3

GRID:

antd provides plenty of UI components to enrich your web applications, and we will improve components experience consistently. We also recommend some great additionally.

Ant Design's grid system
Ant Design Docs
Third-Party Libraries
Button
Icon
Typography
Divider
Grid
Layout
Space
Affix
Breadcrumb
Dropdown
Menu
Pagination
PageHeader
Steps
AutoComplete
Checkbox
Cascader
DatePicker
Form
InputNumber
Input
Mentions
Rate
Radio
Switch
Slider
Select
TreeSelect
Transfer
TimePicker
Upload
Avatar
Badge
Comment
Collapse
Carousel
Card
Calendar
Descriptions
Empty
Image
List
Popover
Statistic
Tree
Tooltip
Timeline
Tag
Tabs
Table
Alert
Drawer
Modal
Message
Notification
Progress
Popconfirm
Result
Spin
Skeleton
Anchor
BackTop
ConfigProvider
Button
Icon
Typography
Divider
Grid
Layout
Space
Affix
Breadcrumb
Dropdown
Menu
Pagination
PageHeader
Steps
AutoComplete
Checkbox
Cascader
DatePicker
Form
InputNumber
Input
Mentions
Rate
Radio
Switch
Slider
Select
TreeSelect
Transfer
TimePicker
Upload
Avatar
Badge
Comment
Collapse
Carousel
Card
Calendar
Descriptions
Empty
Image
List
Popover
Statistic
Tree
Tooltip
Timeline
Tag
Tabs
Table
Alert
Drawer
Modal
Message
Notification
Progress
Popconfirm
Result
Spin
Skeleton
Anchor
BackTop
ConfigProvider