Skip to content

Commit b318cd8

Browse files
authored
Inline documentation (#79)
* document accordion component * document alert dialog * document aspect ratio * document avatar * document calendar component * document checkbox component * document collapsible * document context menu * document dialog component * document dropdown menu * document hover card * document label * Document menubar * document navbar * document popover * document progress component * document radio group * document scroll area * document separator * document switch component * document tabs * document toggle * document select component * document toggle group * document more menu props * revert complains changes * document tooltip * document toolbar * document toast provider component * fix tests * remove broken support for range sliders * document slider component * add a short readme * fix clippy * Fix a few props with missing docs * fix docs test * switch the title of the styled components to from dioxus primitives to dioxus components
1 parent 6517606 commit b318cd8

35 files changed

+4750
-515
lines changed

preview/src/components/hover_card/docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ HoverCard {
1313
// The HoverCardContent contains the content that will be displayed when the user hovers over the trigger.
1414
HoverCardContent {
1515
// The side of the HoverCardTrigger where the content will be displayed. Can be one Top, Right, Bottom, or Left.
16-
side: HoverCardSide::Bottom,
16+
side: ContentSide::Bottom,
1717
// The alignment of the HoverCardContent relative to the HoverCardTrigger. Can be one of Start, Center, or End.
18-
align: HoverCardAlign::Start,
18+
align: ContentAlign::Start,
1919
// The content of the hover card, which can include text, images, or any other elements.
2020
{children}
2121
}

preview/src/components/hover_card/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use dioxus::prelude::*;
2-
use dioxus_primitives::hover_card::{
3-
HoverCard, HoverCardContent, HoverCardSide, HoverCardTrigger,
2+
use dioxus_primitives::{
3+
hover_card::{HoverCard, HoverCardContent, HoverCardTrigger},
4+
ContentSide,
45
};
6+
57
#[component]
68
pub(super) fn Demo() -> Element {
79
rsx! {
@@ -15,7 +17,7 @@ pub(super) fn Demo() -> Element {
1517
HoverCardTrigger { class: "hover-card-trigger",
1618
i { "Dioxus" }
1719
}
18-
HoverCardContent { class: "hover-card-content", side: HoverCardSide::Bottom,
20+
HoverCardContent { class: "hover-card-content", side: ContentSide::Bottom,
1921
div {
2022
padding: "1rem",
2123
"Dioxus is"

preview/src/components/toast/docs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ ToastProvider {
1313
toast_api
1414
.error(
1515
"Critical Error".to_string(),
16-
Some(ToastOptions {
17-
permanent: true,
18-
..Default::default()
19-
}),
16+
ToastOptions::new()
17+
.description("Some info you need")
18+
.duration(Duration::from_secs(60))
19+
.permanent(false),
2020
);
2121
},
2222
"Show Toast"

preview/src/components/toast/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ fn ToastButton() -> Element {
3030
toast_api
3131
.info(
3232
"Custom Toast".to_string(),
33-
Some(ToastOptions {
34-
description: Some(
35-
"Some info you need".to_string(),
36-
),
37-
duration: Some(Duration::from_secs(60)),
38-
permanent: false,
39-
}),
33+
ToastOptions::new()
34+
.description("Some info you need")
35+
.duration(Duration::from_secs(60))
36+
.permanent(false),
4037
);
4138
},
4239
"Info (60s)"

preview/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ fn Home(iframe: Option<bool>, dark_mode: Option<bool>) -> Element {
527527
main {
528528
role: "main",
529529
div { id: "hero",
530-
h1 { "Dioxus Primitives" }
530+
h1 { "Dioxus Components" }
531531
h2 {
532532
b { "Accessible" }
533533
", "

primitives/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<div align="center">
2+
<h1>🎲 Dioxus Primitives 🧱</h1>
3+
<p><strong>Accessible, unstyled, foundational components for Dioxus.</strong></p>
4+
</div>
5+
6+
<div align="center">
7+
<!-- Crates version -->
8+
<a href="https://crates.io/crates/dioxus-primitives">
9+
<img src="https://img.shields.io/crates/v/dioxus-primitives.svg?style=flat-square"
10+
alt="Crates.io version" />
11+
</a>
12+
<!-- Downloads -->
13+
<a href="https://crates.io/crates/dioxus-primitives">
14+
<img src="https://img.shields.io/crates/d/dioxus-primitives.svg?style=flat-square"
15+
alt="Download" />
16+
</a>
17+
<!-- docs -->
18+
<a href="https://docs.rs/dioxus-primitives">
19+
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
20+
alt="docs.rs docs" />
21+
</a>
22+
</div>
23+
24+
---
25+
26+
<br/>
27+
28+
Dioxus primitives is an ARIA-accessible, unstyled, foundational component library for Dioxus based on Radix Primitives. It defines the structure and behavior of components without imposing any specific styles. You can bring your own design patterns and styles to create a consistent look and feel for your application.
29+
30+
If you are looking for a starting point to develop a styled component library for your application, you can use our shadcn-style [dioxus components](https://dioxuslabs.github.io/components) or a community library.
31+
32+
## License
33+
34+
This project is dual licensed under the [MIT](./LICENSE-MIT) and [Apache 2.0](./LICENSE-APACHE) licenses.
35+
36+
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)