ark
Build your design system with React, Svelte, Vue, and Solid. Powered by State Machines
Top Related Projects
Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
A utility-first CSS framework for rapid UI development.
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
👩🎤 CSS-in-JS library designed for high performance style composition
An enterprise-class UI design language and React UI library
Quick Overview
Chakra UI Ark is an open-source project that aims to provide a set of low-level, headless UI components for building accessible and customizable user interfaces. It serves as the foundation for Chakra UI v3, offering a more flexible and composable approach to UI development.
Pros
- Highly customizable and flexible components
- Focus on accessibility and adherence to WAI-ARIA standards
- Framework-agnostic, can be used with various JavaScript libraries and frameworks
- Lightweight and performant due to its headless nature
Cons
- Still in development, may have incomplete features or documentation
- Requires more setup and configuration compared to fully styled component libraries
- Steeper learning curve for developers used to pre-styled components
- Limited community resources and examples due to its early stage
Code Examples
- Creating a custom checkbox using Ark:
import { useCheckbox } from "@chakra-ui/ark"
function CustomCheckbox() {
const checkbox = useCheckbox()
return (
<label>
<input type="checkbox" {...checkbox.inputProps} />
<div {...checkbox.controlProps}>
{checkbox.isChecked ? "✓" : null}
</div>
Click me
</label>
)
}
- Implementing a custom select component:
import { useSelect } from "@chakra-ui/ark"
function CustomSelect() {
const select = useSelect({
items: ["Apple", "Banana", "Orange"],
})
return (
<div>
<button {...select.triggerProps}>{select.selectedItem || "Select a fruit"}</button>
<ul {...select.contentProps}>
{select.items.map((item) => (
<li key={item} {...select.getItemProps({ item })}>
{item}
</li>
))}
</ul>
</div>
)
}
- Creating an accessible modal dialog:
import { useModal } from "@chakra-ui/ark"
function AccessibleModal() {
const modal = useModal()
return (
<>
<button {...modal.triggerProps}>Open Modal</button>
{modal.isOpen && (
<div {...modal.backdropProps}>
<div {...modal.contentProps}>
<h2 {...modal.titleProps}>Modal Title</h2>
<p>Modal content goes here</p>
<button {...modal.closeButtonProps}>Close</button>
</div>
</div>
)}
</>
)
}
Getting Started
To start using Chakra UI Ark, follow these steps:
-
Install the package:
npm install @chakra-ui/ark
-
Import and use the desired hooks in your components:
import { useButton } from "@chakra-ui/ark" function MyButton() { const button = useButton() return <button {...button.buttonProps}>Click me</button> }
-
Customize the components by adding your own styles and logic as needed.
Competitor Comparisons
Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
Pros of Fluent UI
- Extensive component library with a wide range of UI elements
- Strong integration with Microsoft products and services
- Robust documentation and design guidelines
Cons of Fluent UI
- Steeper learning curve due to its complexity
- Less flexibility for customization compared to Ark
- Larger bundle size, which may impact performance
Code Comparison
Ark:
import { Button } from '@ark-ui/react'
function App() {
return <Button>Click me</Button>
}
Fluent UI:
import { PrimaryButton } from '@fluentui/react'
function App() {
return <PrimaryButton>Click me</PrimaryButton>
}
Key Differences
- Ark focuses on providing unstyled, accessible components with a smaller footprint
- Fluent UI offers a complete design system with pre-styled components
- Ark allows for more customization and flexibility in styling
- Fluent UI provides a more opinionated and consistent look out-of-the-box
Use Cases
- Choose Ark for projects requiring high customization and smaller bundle sizes
- Opt for Fluent UI when building applications that align with Microsoft's design language or require extensive pre-built components
Community and Support
- Fluent UI has a larger community and more resources due to Microsoft backing
- Ark is newer but gaining traction in the React community for its flexibility
Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
Pros of Material-UI
- Extensive component library with a wide range of pre-built UI elements
- Strong community support and extensive documentation
- Mature project with a long history and proven track record
Cons of Material-UI
- Larger bundle size due to comprehensive feature set
- Steeper learning curve for customization and theming
- More opinionated design system, which may limit flexibility
Code Comparison
Material-UI:
import { Button } from '@mui/material';
<Button variant="contained" color="primary">
Click me
</Button>
Ark:
import { Button } from '@chakra-ui/ark';
<Button variant="solid" colorScheme="blue">
Click me
</Button>
Key Differences
- Ark is a newer project focused on headless components and flexibility
- Material-UI provides a complete design system, while Ark offers more customization options
- Ark has a smaller footprint and aims for better performance
- Material-UI has a larger ecosystem of third-party components and tools
Use Cases
- Choose Material-UI for rapid development with a consistent, pre-designed look
- Opt for Ark when you need more control over styling and want to build custom design systems
Community and Support
- Material-UI has a larger community and more resources available
- Ark is growing but has less third-party content and fewer Stack Overflow answers
A utility-first CSS framework for rapid UI development.
Pros of Tailwind CSS
- Larger community and ecosystem, with more resources and third-party tools
- More flexible and customizable, allowing for fine-grained control over styles
- Faster development process due to utility-first approach
Cons of Tailwind CSS
- Steeper learning curve, especially for developers new to utility-first CSS
- Can lead to verbose HTML markup with multiple classes
- Requires additional configuration for optimal performance
Code Comparison
Tailwind CSS:
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Click me
</button>
Ark:
<Button colorScheme="blue" size="md">
Click me
</Button>
Additional Notes
Tailwind CSS is a utility-first CSS framework, while Ark is a component library built on top of Chakra UI. Tailwind focuses on providing low-level utility classes, giving developers more control over styling. Ark, on the other hand, offers pre-built, accessible components with a consistent design system.
Tailwind CSS has a larger community and more extensive documentation, making it easier to find solutions and resources. However, Ark benefits from Chakra UI's strong focus on accessibility and theming capabilities.
Ultimately, the choice between Tailwind CSS and Ark depends on project requirements, team preferences, and development approach.
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
Pros of styled-components
- Mature and widely adopted with a large community and ecosystem
- Supports dynamic styling based on props and themes
- Seamless integration with React components
Cons of styled-components
- Larger bundle size compared to Ark
- Steeper learning curve for developers new to CSS-in-JS
- Potential performance overhead due to runtime style generation
Code Comparison
styled-components:
const Button = styled.button`
background-color: ${props => props.primary ? 'blue' : 'white'};
color: ${props => props.primary ? 'white' : 'blue'};
padding: 10px 20px;
border: 2px solid blue;
`;
Ark:
import { button } from '@ark-ui/react';
const buttonRecipe = button.raw({
base: {
bg: 'blue.500',
color: 'white',
px: '4',
py: '2',
borderRadius: 'md',
},
});
Ark focuses on a more atomic and composable approach to styling, while styled-components offers a more traditional CSS-like syntax within JavaScript. Ark aims to provide better performance and a smaller bundle size, but styled-components has the advantage of wider adoption and a more extensive ecosystem.
👩🎤 CSS-in-JS library designed for high performance style composition
Pros of Emotion
- Mature and widely adopted CSS-in-JS solution with a large ecosystem
- Offers both object and string styles, providing flexibility in styling approaches
- Supports server-side rendering out of the box
Cons of Emotion
- Requires additional setup and configuration for optimal performance
- Learning curve for developers new to CSS-in-JS concepts
- Can lead to larger bundle sizes if not optimized properly
Code Comparison
Emotion:
import { css } from '@emotion/react'
const style = css`
background-color: hotpink;
&:hover {
color: ${props => props.color};
}
`
Ark:
import { css } from '@ark-ui/react'
const style = css({
backgroundColor: 'hotpink',
'&:hover': {
color: props => props.color
}
})
Both Emotion and Ark provide CSS-in-JS solutions, but Ark is specifically designed for building design systems and component libraries. Emotion offers more flexibility and a broader range of use cases, while Ark focuses on providing a foundation for creating consistent and accessible UI components. Ark also emphasizes type safety and runtime performance, which may be advantageous for larger projects or teams prioritizing these aspects.
An enterprise-class UI design language and React UI library
Pros of Ant Design
- Extensive component library with a wide range of pre-built UI elements
- Strong community support and extensive documentation
- Mature and battle-tested in production environments
Cons of Ant Design
- Opinionated design system, which may limit customization flexibility
- Larger bundle size due to the comprehensive component set
- Steeper learning curve for developers new to the ecosystem
Code Comparison
Ant Design (Button component):
import { Button } from 'antd';
const MyComponent = () => (
<Button type="primary">Click me</Button>
);
Ark (Button component):
import { Button } from '@chakra-ui/ark';
const MyComponent = () => (
<Button variant="solid">Click me</Button>
);
Key Differences
- Ark focuses on providing low-level primitives, while Ant Design offers a complete UI kit
- Ark emphasizes customization and flexibility, whereas Ant Design provides a more opinionated design system
- Ant Design has a larger ecosystem and more third-party extensions
- Ark is newer and still in development, while Ant Design is more established and widely adopted
Use Cases
- Choose Ant Design for rapid development of enterprise-level applications with a consistent look and feel
- Opt for Ark when building custom design systems or requiring more granular control over components
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
@ark
What is Ark UI?
Ark UI is a headless UI library with over 45+ components designed to build reusable, scalable Design Systems that works for a wide range of JS frameworks.
Documentation
For more detailed documentation and examples, please visit the official documentation.
Roadmap
You can request, vote for, and check upcoming features on our roadmap.
Contribution
We welcome contributions to Ark UI. Please read our contributing guidelines for more information on how to contribute.
License
This project is licensed under the terms of the MIT license.
Top Related Projects
Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
A utility-first CSS framework for rapid UI development.
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
👩🎤 CSS-in-JS library designed for high performance style composition
An enterprise-class UI design language and React UI library
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot