Expand description
basecoat — umbrella re-export crate.
This is the single entry point for consuming basecoat UI components in Rust.
Add basecoat to your Cargo.toml and import everything from here.
§30-second start
use basecoat::{rsx, ButtonVariant};
let html: basecoat::Markup = rsx! {
<Button variant={ButtonVariant::Primary}>"Click"</Button>
};
assert!(html.to_string().contains("btn-primary"));
assert!(html.to_string().contains("Click"));Re-exports§
pub use basecoat_components as components;pub use basecoat_macros_rt;pub use basecoat_css as css;
Modules§
Macros§
- rsx
- JSX-like template macro that emits pre-rendered HTML as
::basecoat_core::Markup.
Structs§
- Alert
Props - AttrMap
- An ordered list of HTML attribute key-value pairs.
- Badge
Props - Button
Props - Card
Props - Card has a single CSS class
.card— no variants. - Children
- Pre-rendered inner HTML produced by
rsx!. - Combobox
Option - A single option in a Combobox listbox.
- Combobox
Props - Combobox — input with a filtered listbox of suggestions.
- Dialog
Props - Dialog — maps to CSS class
.dialog. - Dropdown
Item - A single item in a dropdown menu.
- Dropdown
Props - Dropdown — maps to CSS class
.dropdown-menu. - Input
Props - Input — maps to CSS class
.input. No variants. - Label
Props - Label — maps to CSS class
.label. No variants. - Markup
- Pre-escaped HTML fragment. Do not double-escape when rendering.
- Popover
Props - Popover — maps to CSS class
.popoveron a<details>element. - Select
Option - A single option in a
SelectProps::optionslist. - Select
Props - Select — maps to CSS class
.select(custom-styled native form select). - Separator
Props - Separator — rendered as
<hr role="separator">. No CSS class, no variants. Upstream basecoat usesrole="separator"with CSS that targets that attribute. - Sidebar
Props - Sidebar — maps to CSS class
.sidebar. - TabSet
- A single tab within a
TabsProps. - Tabs
Props - Tabs — maps to CSS class
.tabs. - Textarea
Props - Textarea — maps to CSS class
.textarea. No variants. - Toast
Props - Props for a single toast message.
- Toaster
Props - Props for the toaster container that holds multiple toasts.
- Tooltip
Props - Tooltip — CSS-only via
data-tooltipand optionaldata-sideattributes. No separate container element needed — the tooltip wraps the trigger.
Enums§
- Alert
Variant - Alert variant — maps to
.alertor.alert-destructive. - Badge
Variant - Badge visual variant — maps to
.badge,.badge-secondary, etc. - Button
Size - Button size variant.
- Button
Variant - Button visual variant — maps to upstream CSS class prefix.
- Popover
Placement - Popover placement — passed to the floating-ui controller as the
placementargument. - Tabs
Orientation - Tabs orientation — upstream uses
aria-orientationon the tablist<nav>. - Toast
Category - Toast category — maps to
data-categoryattribute. Determines icon and ARIA role in upstream basecoat.
Derive Macros§
- Basecoat
Props #[derive(BasecoatProps)]generates a builder for component prop structs.