Dioxus 的可访问、未设置样式的基础组件。
Dioxus Components is a shadcn style component library for Dioxus built on top of the unstyled 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.
First, explore the component gallery to find the components you want to use.
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:
cargo install dioxus-cliThen, you can add a component to your project with:
dx components add buttonThis 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.
This repository contains two main crates:
dioxus-primitives: The core unstyled component library.preview: A Dioxus application that showcases the components from dioxus-primitives with shadcn-styled versions.If you want to add a new component, you should:
dioxus-primitives crate. When adding components to the primitives library, ensure: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.playwright to ensure the component behaves as expected.The components use a combination of unit tests with cargo, css linting, and end-to-end tests with Playwright.
To run the unit tests for the dioxus-primitives crate, use:
cargo test -p dioxus-primitivesTo run the CSS linting, use:
cd preview
npm install
npx stylelint "src/**/*.css"To run the Playwright end-to-end tests, use:
cd playwright
npm install
npx playwright testTo test your changes, you can run the preview application. For a desktop build, use:
dx serve -p preview --desktopor for the web build:
dx serve -p preview --webThis project is dual licensed under the MIT and Apache 2.0 licenses.
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.
暂无开放 Issues,或尚未同步最近议题。