|
| 1 | +--- |
| 2 | +title: Design Principles |
| 3 | +description: Principles that keep Chakra's components fairly consistent |
| 4 | +--- |
| 5 | + |
| 6 | +Chakra UI is established on principles that keep its components fairly |
| 7 | +consistent. Understanding these concepts will help you better contribute to |
| 8 | +Chakra UI. |
| 9 | + |
| 10 | +Our goal is to design simple, composable components that cater to real-life UI |
| 11 | +design problems. In order to do that, we developed a set of principles that help |
| 12 | +us always be on that path. |
| 13 | + |
| 14 | +- **Style Props:** All component styles can be overridden or extended via style |
| 15 | + props to reduce the use of `css` prop or `styled()`. Compose new components from `Box`. |
| 16 | + |
| 17 | +- **Simplicity:** Strive to keep the component API fairly simple and show real |
| 18 | + world scenarios of using the component. |
| 19 | + |
| 20 | +- **Composition:** Break down components into smaller parts with minimal props |
| 21 | + to keep complexity low, and compose them together. This will ensure that the |
| 22 | + styles and functionality are flexible and extensible. |
| 23 | + |
| 24 | +- **Accessibility:** When creating a component, keep accessibility top of mind. |
| 25 | + This includes keyboard navigation, focus management, color contrast, voice |
| 26 | + over, and the correct `aria-*` attributes. |
| 27 | + |
| 28 | +- **Dark Mode:** Make components dark mode compatible. Use `useColorMode` hook |
| 29 | + to handle styling. [Learn more about dark mode](/docs/features/color-mode). |
| 30 | + |
| 31 | +- **Naming Props:** We all know naming is the hardest thing in this industry. |
| 32 | + Generally, ensure a prop name is indicative of what it does. Boolean props |
| 33 | + should be named using auxiliary verbs such as `does`, `has`, `is` and |
| 34 | + `should`. For example, `Button` uses `isDisabled`, `isLoading`, etc. |
0 commit comments