shadcn_rs/lib.rs
1//! shadcn-rs: A comprehensive UI component library for Rust/WebAssembly
2//!
3//! This library provides shadcn/ui compatible components for building modern web
4//! applications with Rust and Yew.
5//!
6//! # Quick Start
7//!
8//! ```rust,no_run
9//! use yew::prelude::*;
10//! use shadcn_rs::{Button, Variant, Size};
11//!
12//! #[function_component(App)]
13//! fn app() -> Html {
14//! let onclick = Callback::from(|_| {
15//! web_sys::console::log_1(&"Button clicked!".into());
16//! });
17//!
18//! html! {
19//! <Button variant={Variant::Primary} size={Size::Lg} onclick={onclick}>
20//! { "Click me" }
21//! </Button>
22//! }
23//! }
24//! ```
25//!
26//! # Features
27//!
28//! - 59+ accessible, customizable components
29//! - Full keyboard navigation support
30//! - Dark mode support via CSS variables
31//! - Touch gesture support for mobile
32//! - Type-safe component APIs with Rust enums
33//!
34//! # CSS
35//!
36//! Include the shadcn-rs CSS file in your HTML:
37//!
38//! ```html
39//! <link rel="stylesheet" href="shadcn-rs.css">
40//! ```
41
42#![warn(missing_docs)]
43#![deny(unsafe_op_in_unsafe_fn)]
44
45pub mod components;
46pub mod hooks;
47pub mod types;
48pub mod utils;
49
50// Re-export commonly used types
51pub use types::{Alignment, Color, Position, Size, Variant};
52
53// Re-export commonly used utilities
54pub use utils::{Portal, class_if, class_names, generate_id, use_portal};
55
56// Re-export commonly used hooks
57pub use hooks::{
58 use_click_outside, use_click_outside_conditional, use_controllable_bool,
59 use_controllable_state, use_controllable_state_optional, use_escape_key,
60 use_escape_key_conditional, use_key_press, use_toggle, use_toggle_with_controls,
61};
62
63// Re-export all components
64pub use components::*;
65
66/// Library version
67pub const VERSION: &str = env!("CARGO_PKG_VERSION");