Skip to content

Commit 251f298

Browse files
committed
Expand readme
1 parent 545aa7f commit 251f298

File tree

1 file changed

+72
-53
lines changed

1 file changed

+72
-53
lines changed

README.md

Lines changed: 72 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
2-
<h1>🎲 Dioxus Primitives 🧱</h1>
3-
<p><strong>Accessible, unstyled, foundational components for Dioxus.</strong></p>
2+
<h1>Dioxus Components</h1>
3+
<p><strong>Accessible, customizable components for Dioxus.</strong></p>
44
</div>
55

66
<div align="center">
@@ -25,66 +25,85 @@
2525

2626
<br/>
2727

28-
Dioxus primitives is an ARIA-accessible, unstyled, foundational component library for Dioxus based on Radix Primitives. We bring the logic, you bring the styling.
29-
30-
Building styled and more featured component libraries on top of Dioxus Primitives is encouraged!
31-
32-
## Here's what we have.
33-
34-
We're still in the early days - Many components are still being created and stabilized.
35-
36-
31/31
37-
38-
- [x] Accordion
39-
- [x] Alert Dialog
40-
- [x] Aspect Ratio
41-
- [x] Avatar
42-
- [x] Calendar
43-
- [x] Card
44-
- [x] Checkbox
45-
- [x] Collapsible
46-
- [x] Context Menu
47-
- [x] Date Picker
48-
- [x] Dialog
49-
- [x] Dropdown Menu
50-
- [x] Hover Card
51-
- [x] Label
52-
- [x] Menubar
53-
- [x] Navigation Menu
54-
- [x] Popover
55-
- [x] Progress
56-
- [x] Radio Group
57-
- [x] Scroll Area
58-
- [x] Select
59-
- [x] Separator
60-
- [x] Sheet
61-
- [x] Slider
62-
- [x] Switch
63-
- [x] Tabs
64-
- [x] Textarea
65-
- [x] Toast
66-
- [x] Toggle
67-
- [x] Toggle Group
68-
- [x] Toolbar
69-
- [x] Tooltip
70-
71-
## Running the preview.
72-
73-
You can run the `preview` app with:
28+
Dioxus Components is a shadcn style component library for Dioxus built on top of the unstyled [Dioxus primitives](https://crates.io/crates/dioxus-primitives) library. The unstyled primitives serve as the foundation for building accessible and customizable UI components in Dioxus applications. The styled versions serve as a starting point to develop your own design system.
29+
30+
## Getting started
31+
32+
First, explore the [component gallery](https://dioxuslabs.github.io/components/) to find the components you want to use.
33+
34+
Once you find a component, you can add it to your project with the Dioxus CLI. If you don't already have `dx` installed, you can do so with:
7435

7536
```
76-
cargo run -p preview --features desktop
37+
cargo install dioxus-cli
7738
```
7839

79-
or for the web build
40+
Then, you can add a component to your project with:
8041

8142
```
82-
cargo binstall dioxus-cli -y --force --version 0.7.0
83-
dx run -p preview --web
43+
dx components add button
44+
```
45+
46+
This will create a `components` folder in your project (if it doesn't already exist) and add the `Button` component files to it. If this is your first time adding a component, it will also prompt you to add a link to `/assets/dx-components.css` at the root of your app to provide the theme for your app.
47+
48+
## Contributing
49+
50+
### Project structure
51+
52+
This repository contains two main crates:
53+
- `dioxus-primitives`: The core unstyled component library.
54+
- `preview`: A Dioxus application that showcases the components from `dioxus-primitives` with shadcn-styled versions.
55+
56+
### Adding new components
57+
58+
If you want to add a new component, you should:
59+
1. If there is any new interaction logic or accessibility features required, implement an unstyled component in the `dioxus-primitives` crate. When adding components to the primitives library, ensure:
60+
- It adheres to the [WAI-ARIA Authoring Practices for accessibility](https://www.w3.org/WAI/standards-guidelines/aria/).
61+
- All styling can be modified via props. Every element should spread attributes and children from the props
62+
2. In the `preview` crate, create a styled version of the component using shadcn styles. This will serve as an example of how to use the unstyled component and serve as the styled version `dx components` will add to projects.
63+
3. Add tests in `playwright` to ensure the component behaves as expected.
64+
65+
### Testing changes
66+
67+
The components use a combination of unit tests with cargo, css linting, and end-to-end tests with Playwright.
68+
69+
To run the unit tests for the `dioxus-primitives` crate, use:
70+
71+
```sh
72+
cargo test -p dioxus-primitives
73+
```
74+
75+
To run the CSS linting, use:
76+
77+
```sh
78+
cd preview
79+
npm install
80+
npx stylelint "src/**/*.css"
81+
```
82+
83+
To run the Playwright end-to-end tests, use:
84+
85+
```sh
86+
cd preview
87+
npm install
88+
npx playwright test
89+
```
90+
91+
### Running the preview
92+
93+
To test your changes, you can run the preview application. For a desktop build, use:
94+
95+
```sh
96+
dx serve -p preview --desktop
97+
```
98+
99+
or for the web build:
100+
101+
```sh
102+
dx serve -p preview --web
84103
```
85104

86105
## License
87106

88107
This project is dual licensed under the [MIT](./LICENSE-MIT) and [Apache 2.0](./LICENSE-APACHE) licenses.
89108

90-
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repository, by you, shall be licensed as MIT or Apache 2.0, without any additional terms or conditions.
109+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repository, by you, shall be licensed as MIT or Apache 2.0, without any additional terms or conditions.

0 commit comments

Comments
 (0)