Skip to main content

Crate basecoat

Crate basecoat 

Source
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§

attrs
children
classes
markup
props

Macros§

rsx
JSX-like template macro that emits pre-rendered HTML as ::basecoat_core::Markup.

Structs§

AlertProps
AttrMap
An ordered list of HTML attribute key-value pairs.
BadgeProps
ButtonProps
CardProps
Card has a single CSS class .card — no variants.
Children
Pre-rendered inner HTML produced by rsx!.
ComboboxOption
A single option in a Combobox listbox.
ComboboxProps
Combobox — input with a filtered listbox of suggestions.
DialogProps
Dialog — maps to CSS class .dialog.
DropdownItem
A single item in a dropdown menu.
DropdownProps
Dropdown — maps to CSS class .dropdown-menu.
InputProps
Input — maps to CSS class .input. No variants.
LabelProps
Label — maps to CSS class .label. No variants.
Markup
Pre-escaped HTML fragment. Do not double-escape when rendering.
PopoverProps
Popover — maps to CSS class .popover on a <details> element.
SelectOption
A single option in a SelectProps::options list.
SelectProps
Select — maps to CSS class .select (custom-styled native form select).
SeparatorProps
Separator — rendered as <hr role="separator">. No CSS class, no variants. Upstream basecoat uses role="separator" with CSS that targets that attribute.
SidebarProps
Sidebar — maps to CSS class .sidebar.
TabSet
A single tab within a TabsProps.
TabsProps
Tabs — maps to CSS class .tabs.
TextareaProps
Textarea — maps to CSS class .textarea. No variants.
ToastProps
Props for a single toast message.
ToasterProps
Props for the toaster container that holds multiple toasts.
TooltipProps
Tooltip — CSS-only via data-tooltip and optional data-side attributes. No separate container element needed — the tooltip wraps the trigger.

Enums§

AlertVariant
Alert variant — maps to .alert or .alert-destructive.
BadgeVariant
Badge visual variant — maps to .badge, .badge-secondary, etc.
ButtonSize
Button size variant.
ButtonVariant
Button visual variant — maps to upstream CSS class prefix.
PopoverPlacement
Popover placement — passed to the floating-ui controller as the placement argument.
TabsOrientation
Tabs orientation — upstream uses aria-orientation on the tablist <nav>.
ToastCategory
Toast category — maps to data-category attribute. Determines icon and ARIA role in upstream basecoat.

Derive Macros§

BasecoatProps
#[derive(BasecoatProps)] generates a builder for component prop structs.