MCPcopy Index your code
hub / github.com/DioxusLabs/dioxus-components

github.com/DioxusLabs/dioxus-components @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,519 symbols 2,751 edges 286 files 132 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Dioxus Components

Accessible, customizable components for Dioxus.

Crates.io version

Download

docs.rs docs


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.

Getting started

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-cli

Then, you can add a component to your project with:

dx components add button

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.

Contributing

Project structure

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.

Adding new components

If you want to add a new component, you should: 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: - It adheres to the WAI-ARIA Authoring Practices for accessibility. - All styling can be modified via props. Every element should spread attributes and children from the props 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. 3. Add tests in playwright to ensure the component behaves as expected.

Testing changes

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-primitives

To 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 test

Running the preview

To test your changes, you can run the preview application. For a desktop build, use:

dx serve -p preview --desktop

or for the web build:

dx serve -p preview --web

License

This 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.

Extension points exported contracts — how you extend this code

DefaultCalendarProps (Interface)
A trait for types that can provide default calendar rendering. [2 implementers]
primitives/src/date_picker.rs
DynPartialEq (Interface)
(no doc) [1 implementers]
primitives/src/selection.rs
LocalDateExt (Interface)
(no doc) [1 implementers]
primitives/src/lib.rs
Window (Interface)
(no doc)
primitives/src/ts/focus-trap.ts

Core symbols most depended-on inside this repo

iter
called by 96
primitives/src/calendar.rs
merge_attributes
called by 90
primitives/src/lib.rs
first
called by 63
primitives/src/calendar.rs
use_unique_id
called by 36
primitives/src/lib.rs
sender
called by 27
preview/src/dashboard/common/messages.rs
use_id_or
called by 25
primitives/src/lib.rs
set_focus
called by 23
primitives/src/collection.rs
use_controlled
called by 21
primitives/src/lib.rs

Shape

Function 795
Class 355
Method 320
Enum 45
Interface 4

Languages

Rust97%
TypeScript3%

Modules by API surface

primitives/src/calendar.rs131 symbols
preview/src/main.rs68 symbols
primitives/src/collection.rs58 symbols
primitives/src/drag_and_drop_list.rs45 symbols
primitives/src/date_picker.rs44 symbols
primitives/src/tag_group.rs43 symbols
preview/src/components/sidebar/component.rs37 symbols
preview/src/components/calendar/component.rs35 symbols
primitives/src/toast.rs34 symbols
primitives/src/lib.rs30 symbols
preview/src/dashboard/views/email_client/state.rs30 symbols
primitives/src/color_picker.rs29 symbols

For agents

$ claude mcp add dioxus-components \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact