lumen-dioxus 6.0.0

Lumen UI components for Dioxus: web, desktop, mobile, and Dioxus Native (Blitz).
Documentation
//! Lumen UI components for [Dioxus](https://dioxuslabs.com).
//!
//! The components render the same classes and attributes as `@santi020k/lumen-react`, so they
//! share Lumen's stylesheet. They work with every Dioxus renderer: web, desktop and mobile
//! (webview), and Dioxus Native, which draws HTML and CSS with the Blitz engine instead of a
//! webview. Interactions run in Rust, so they also work where there is no JavaScript.
//!
//! ```toml
//! [dependencies]
//! lumen-dioxus = "6.0"
//! ```
//!
//! Render [`LumenStyles`] once near the root, wrap the app in [`LumenTheme`], and use the
//! components from the [`prelude`]:
//!
//! ```
//! use dioxus::prelude::*;
//! use lumen_dioxus::prelude::*;
//!
//! #[component]
//! fn App() -> Element {
//!     rsx! {
//!         LumenStyles {}
//!         LumenTheme { scheme: LumenScheme::Dark,
//!             Card {
//!                 CardHeader {
//!                     CardTitle { "Workspace plan" }
//!                     CardDescription { "Shared libraries and audit logs." }
//!                 }
//!                 CardFooter {
//!                     Button { variant: ButtonVariant::Secondary, "Compare plans" }
//!                     Button { onclick: move |_| {}, "Upgrade" }
//!                 }
//!             }
//!         }
//!     }
//! }
//! ```
//!
//! Icons live in [`icons`]; brand icons need the `brand-icons` feature. On Dioxus Native,
//! check controls render as ARIA buttons, glass needs a renderer with `backdrop-filter` support,
//! placeholders do not show yet, and web platform APIs such as the clipboard fall back to a
//! documented state. The crate README lists every component and the renderer notes.

mod button;
mod class;
mod feedback;
mod form;
mod surface;
mod tabs;

pub mod hooks;
pub mod icons;
pub mod overlay;
pub mod time;

mod theme;

mod charts;
mod content;
mod data;
mod inputs;
mod layout;
mod motion;
mod navigation;
mod overlays;
mod pickers;

use dioxus::prelude::*;

pub use button::{Button, ButtonProps, ButtonSize, ButtonTone, ButtonVariant};
pub use class::{Glass, Orientation};
pub use feedback::{
    Avatar, AvatarProps, AvatarSize, Progress, ProgressProps, ProgressState, Separator,
    SeparatorProps, Spinner, SpinnerProps, normalize_progress,
};
pub use form::{
    Checkbox, CheckboxProps, ControlSize, Field, FieldError, FieldErrorProps, FieldProps, Input,
    InputProps, Label, LabelProps, Switch, SwitchProps, Textarea, TextareaProps,
};
pub use surface::{
    Alert, AlertProps, AlertVariant, Badge, BadgeProps, BadgeVariant, Card, CardContent,
    CardDensity, CardDescription, CardFooter, CardHeader, CardPartProps, CardProps, CardTitle,
    CardVariant,
};
pub use tabs::{
    Tabs, TabsList, TabsListProps, TabsPanel, TabsPanelProps, TabsProps, TabsTrigger,
    TabsTriggerProps,
};

pub use icons::{Icon, IconData, IconProps, IconSize};
pub use theme::{LumenPreset, LumenScheme, LumenTheme, LumenThemeProps};

pub use charts::*;
pub use content::*;
pub use data::*;
pub use inputs::*;
pub use layout::*;
pub use motion::*;
pub use navigation::*;
pub use overlays::*;
pub use pickers::*;

/// Lumen's complete stylesheet, generated from `@santi020k/lumen-core`.
///
/// Use it when you load styles yourself; otherwise render [`LumenStyles`].
pub const LUMEN_CSS: &str = include_str!("../assets/lumen.css");

/// Embeds [`LUMEN_CSS`] in a `<style>` element. Render it once, near the root of the app.
#[component]
pub fn LumenStyles() -> Element {
    rsx! {
        style { {LUMEN_CSS} }
    }
}

/// Everything needed to build a Lumen interface: components, their props and option enums,
/// icons, and [`LumenStyles`].
pub mod prelude {
    pub use crate::icons::{self, Icon, IconData, IconSize};
    pub use crate::{
        Alert, AlertVariant, Avatar, AvatarSize, Badge, BadgeVariant, Button, ButtonSize,
        ButtonTone, ButtonVariant, Card, CardContent, CardDensity, CardDescription, CardFooter,
        CardHeader, CardTitle, CardVariant, Checkbox, ControlSize, Field, FieldError, Glass, Input,
        Label, LumenStyles, Orientation, Progress, Separator, Spinner, Switch, Tabs, TabsList,
        TabsPanel, TabsTrigger, Textarea,
    };
    pub use crate::{LumenPreset, LumenScheme, LumenTheme};

    pub use crate::charts::*;
    pub use crate::content::*;
    pub use crate::data::*;
    pub use crate::inputs::*;
    pub use crate::layout::*;
    pub use crate::motion::*;
    pub use crate::navigation::*;
    pub use crate::overlays::*;
    pub use crate::pickers::*;
}