Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
  </head>
	<body id="root">
		<h1>那些年我用 Ant Design 做過的網頁元件</h1>
		<h2>Day24:Ant Design 裡的 Form 表單(part2)</h2>
		<hr />
    <div id="container" style="padding: 24px" />
    <script>var mountNode = document.getElementById('container');</script>
  </body>
</html>
              
            
!

CSS

              
                @import '~antd/dist/antd.css';


body {
	background: #fffcf0;
}

#root {
  text-align: center;
  margin: 100px auto;
}

h3 {
	color: #6a60a9;
	font-size: 24px;
}

.ant-form-item-label > label{
	color: #534847;
	font-size: 16px;
}

.ant-btn {
  color: #f5f8fa;
	font-size: 14px;
	line-height: 1;
  background: #09091a;
  font-weight: bold;
	padding: 6px 8px;
  border: 2px solid #09091a;
	border-radius: 10px;
}

.ant-input-number{
	width: 100% !important;
}
              
            
!

JS

              
                const { createRoot } = ReactDOM;
const {  FontSizeOutlined, SearchOutlined, LockOutlined  } = icons;
const { 
  Cascader,
  DatePicker,
  Form,
  Input,
  InputNumber,
  Mentions,
  Select,
  TimePicker,
  TreeSelect,
 } = antd;


const { Option } = Select;

const formItemLayout = {
  labelCol: {
    xs: { span: 24 },
    sm: { span: 6 },
  },
  wrapperCol: {
    xs: { span: 24 },
    sm: { span: 14 },
  },
};

const App: React.FC = () => (
  <Form {...formItemLayout}>
		<Form.Item
				name="密碼"
				rules={[{ required: true, message: '請輸入密碼' }]}
		>
				<Input
					prefix={<LockOutlined />}
					type="password"
					placeholder="請輸入密碼"
				/>
		</Form.Item>
		<Form.Item
			name="關鍵字搜尋"
		>
				<Input
					prefix={<SearchOutlined />}
					placeholder="請輸入關鍵字"
				/>
		</Form.Item>
		<Form.Item>
				<Input prefix="¥" suffix="YEN" type="number" />
		</Form.Item>
		<Form.Item>
				<Input prefix="$" suffix="USD" type="number" />
		</Form.Item>
	  <Form.Item 
			label="驗證碼" 
			tooltip="請留意大小寫"
			validateStatus="warning"
		>
      <Input  />
    </Form.Item>

		<Form.Item
			name="email"
			label="Email"
			help="若為免費信箱,請留意驗證信件是否被自動歸類為垃圾郵件"
		>
			<Input />
		</Form.Item>

		<Form.Item 
			label="birthday" 
		>
      <DatePicker style={{ width: '100%' }} placeholder="請選擇您的出生日期" />
    </Form.Item>

  </Form>
);

const ComponentDemo = App;

createRoot(mountNode).render(<ComponentDemo />);

              
            
!
999px

Console