
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
ant-float-label
Advanced tools
A comprehensive wrapper library for Ant Design components that implements the elegant "Floating Label" pattern (similar to Material UI). This library provides a seamless way to modernize your forms while maintaining the full power and theming capabilities of Ant Design.
Install via npm, yarn, or pnpm:
npm install ant-float-label
# or
yarn add ant-float-label
# or
pnpm add ant-float-label
Ensure you have the peer dependencies installed:
npm install antd react react-dom
You can use the components directly. Passing the placeholder prop will automatically act as the floating label content.
import React, { useState } from 'react';
import { FloatInput, FloatSelect } from 'ant-float-label';
const App = () => {
const [value, setValue] = useState('');
return (
<div style={{ padding: 24, display: 'flex', flexDirection: 'column', gap: 16 }}>
{/* The placeholder acts as the floating label */}
<FloatInput
placeholder="Username"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<FloatSelect
placeholder="Gender"
options={[
{ label: 'Male', value: 'male' },
{ label: 'Female', value: 'female' },
]}
/>
</div>
);
};
The recommended way to use this library in forms is with FloatFormItem. It automatically handles the label state and passes it to the underlying component.
import React from 'react';
import { Form, Button } from 'antd';
import { FloatFormItem, FloatInput, FloatPassword } from 'ant-float-label';
const LoginForm = () => {
const [form] = Form.useForm();
const onFinish = (values) => {
console.log('Success:', values);
};
return (
<Form
form={form}
name="login"
onFinish={onFinish}
style={{ maxWidth: 400 }}
>
<FloatFormItem
name="username"
label="Username"
rules={[{ required: true, message: 'Please input your username!' }]}
>
<FloatInput />
</FloatFormItem>
<FloatFormItem
name="password"
label="Password"
rules={[{ required: true, message: 'Please input your password!' }]}
>
<FloatPassword />
</FloatFormItem>
<Form.Item>
<Button type="primary" htmlType="submit" block>
Log in
</Button>
</Form.Item>
</Form>
);
};
All components inherit props from their Ant Design counterparts.
| Component | Description |
|---|---|
FloatInput | Wraps Input |
FloatPassword | Wraps Input.Password |
FloatInputNumber | Wraps InputNumber |
FloatSelect | Wraps Select |
FloatDatePicker | Wraps DatePicker |
FloatRangePicker | Wraps DatePicker.RangePicker |
FloatTimePicker | Wraps TimePicker |
FloatCascader | Wraps Cascader |
FloatTreeSelect | Wraps TreeSelect |
FloatAutoComplete | Wraps AutoComplete |
FloatFormItem | Specialized Form.Item for automatic label handling |
Most components accept all standard Ant Design props for their respective base component (e.g., FloatInput accepts all InputProps).
FloatFormItem, the label prop of the FormItem is automatically used as the floating label.placeholder acts as the floating label text.style, className for the box container).You can customize the appearance by overriding CSS variables or providing labelBoxProps. The library follows Ant Design's design token system, so changing your global theme config will automatically update these components.
<FloatInput
placeholder="Custom Style"
labelBoxProps={{
style: { borderColor: 'red' }
}}
/>
MIT © razr001
FAQs
Antd 6 form style similar to MUI
We found that ant-float-label demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.