Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Demonstrates a simple counter layout using Ant Design components and React for interactivity.
import React, { useState } from 'react';
import { Button, Typography, Space, ConfigProvider, theme } from 'antd';
const { Title } = Typography;
const Counter = () => {
const [count, setCount] = useState(0);
const [isDark, setIsDark] = useState(false);
return (
<ConfigProvider theme={{ token: { colorPrimary: isDark ? '#1f1f1f' : '#1890ff' }, algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm }}>
<div style={{ textAlign: 'center', marginTop: '50px' }}>
<Title level={2}>Counter: {count}</Title>
<Space>
<Button type='primary' onClick={() => setCount(count + 1)}>+</Button>
<Button type='primary' danger onClick={() => setCount(count - 1)}>-</Button>
<Button onClick={() => setCount(0)}>Reset</Button>
</Space>
<br /><br />
<Button type='default' onClick={() => setIsDark(!isDark)}>Switch Theme</Button>
</div>
</ConfigProvider>
);
};
export default Counter;Ant Design (AntD) is a comprehensive, enterprise-class UI design system and React component library for building modern web applications. It provides high-quality prebuilt components, design guidelines, and a unified visual language.
Origin & Creator
Developed by Alibaba in 2014, Ant Design was created to provide a systematic, enterprise-ready design framework and a React component library for building web apps with consistent UI patterns.
Industrial Note
Perfect for enterprise applications, admin dashboards, data-heavy apps, and teams needing a standardized design system with prebuilt, production-ready React components.