Skip to main content

guise/
lib.rs

1//! # guise
2//!
3//! A Mantine-inspired component library for [gpui](https://github.com/zed-industries/zed).
4//!
5//! `guise` provides a themed palette, sizing tokens, and a growing set of
6//! ready-to-use components built on gpui's `RenderOnce` builder pattern.
7//!
8//! ```ignore
9//! use guise::prelude::*;
10//!
11//! Stack::new().gap(Size::Md).child(
12//!     Button::new("save", "Save").variant(Variant::Filled),
13//! )
14//! ```
15//!
16//! Install a [`Theme`] once at startup, then read it from any component:
17//!
18//! ```ignore
19//! guise::theme::Theme::dark().init(cx);
20//! ```
21
22#[macro_use]
23mod macros;
24
25pub mod style;
26pub mod theme;
27
28/// Re-exported so the layout macros can bring `.child()` into scope without
29/// requiring callers to import gpui's `ParentElement`.
30#[doc(hidden)]
31pub use gpui::ParentElement as __ParentElement;
32
33/// Re-exported so the `style!` macro can reference gpui (`px`, `FontWeight`, …)
34/// via `$crate::gpui::…` without the caller importing gpui.
35#[doc(hidden)]
36pub use ::gpui;
37
38pub mod data;
39pub mod feedback;
40pub mod flex;
41pub mod input;
42pub mod layout;
43pub mod nav;
44pub mod overlay;
45pub mod reactive;
46
47mod actionicon;
48mod anchor;
49mod badge;
50mod button;
51mod card;
52mod chip;
53mod closebutton;
54mod code;
55mod copybutton;
56mod divider;
57mod icon;
58mod indicator;
59mod kbd;
60mod paper;
61mod scrollarea;
62mod skeleton;
63mod text;
64mod themeicon;
65mod title;
66mod transition;
67mod webview;
68
69pub use actionicon::ActionIcon;
70pub use anchor::Anchor;
71pub use badge::Badge;
72pub use button::Button;
73pub use card::Card;
74pub use chip::Chip;
75pub use closebutton::CloseButton;
76pub use code::Code;
77pub use copybutton::CopyButton;
78pub use divider::{Divider, Orientation};
79pub use icon::{Icon, IconName};
80pub use indicator::Indicator;
81pub use kbd::Kbd;
82pub use paper::Paper;
83pub use scrollarea::ScrollArea;
84pub use skeleton::Skeleton;
85pub use text::Text;
86pub use themeicon::ThemeIcon;
87pub use title::Title;
88pub use transition::{Collapse, Transition, TransitionKind};
89pub use webview::{WebView, WebViewEvent};
90
91pub use data::{Accordion, Avatar, AvatarGroup, List, Table, Tabs, Timeline};
92pub use feedback::{Alert, Loader, LoaderVariant, Notification, Progress, RingProgress, ToastStack};
93pub use input::{
94    apply_key, Checkbox, CheckboxGroup, Combobox, ComboboxEvent, Field, KeyOutcome, NumberInput,
95    NumberInputEvent, Radio, RadioGroup, SegmentedControl, SegmentedControlEvent, Select,
96    SelectEvent, Slider, SliderEvent, Switch, TextArea, TextAreaEvent, TextEdit, TextInput,
97    TextInputEvent,
98};
99pub use layout::{Align, Center, Group, Justify, SimpleGrid, Stack};
100pub use nav::{Breadcrumbs, NavLink, Pagination, PaginationEvent, StatusBar, Stepper};
101pub use overlay::{
102    tooltip, Drawer, Menu, MenuBar, MenuColumn, Modal, Placement, Popover, Side, Spotlight, Tooltip,
103};
104pub use reactive::{provide, use_context, use_form, use_state, watch, FormState, Signal};
105pub use style::{surface, ColorValue, StyleExt, Surface, Variant};
106pub use theme::{
107    css, hsl, hsla, rgb, rgba, theme, Color, ColorName, ColorScheme, CssColorError, Palette, Scale,
108    Shades, Size, Theme,
109};
110
111pub mod prelude {
112    //! Common imports for building with `guise`.
113    pub use crate::layout::{Align, Center, Group, Justify, Stack};
114    pub use crate::style::{ColorValue, StyleExt, Variant};
115    pub use crate::theme::{
116        css, hsl, hsla, rgb, rgba, theme, Color, ColorName, ColorScheme, Size, Theme,
117    };
118    pub use crate::{color, style};
119    pub use crate::input::{
120        apply_key, Checkbox, CheckboxGroup, Combobox, ComboboxEvent, Field, KeyOutcome, NumberInput,
121        NumberInputEvent, Radio, RadioGroup, Select, SelectEvent, Slider, SliderEvent, Switch,
122        TextArea, TextAreaEvent, TextEdit, TextInput, TextInputEvent,
123    };
124    pub use crate::data::{Accordion, Avatar, AvatarGroup, List, Table, Tabs, Timeline};
125    pub use crate::feedback::{
126        Alert, Loader, LoaderVariant, Notification, Progress, RingProgress, ToastStack,
127    };
128    pub use crate::input::{SegmentedControl, SegmentedControlEvent};
129    pub use crate::{
130        ActionIcon, Anchor, Chip, CloseButton, Code, CopyButton, Icon, IconName, Indicator, Kbd,
131        ScrollArea, Skeleton, ThemeIcon,
132    };
133    pub use crate::layout::SimpleGrid;
134    pub use crate::nav::{
135        Breadcrumbs, NavLink, Pagination, PaginationEvent, StatusBar, Stepper,
136    };
137    pub use crate::{
138        card, center, col, hstack, modal, paper, row, vstack, wrap, zstack,
139    };
140    pub use crate::{badge, button, code, kbd, text, title};
141    pub use crate::overlay::{
142        tooltip, Drawer, Menu, MenuBar, MenuColumn, Modal, Placement, Popover, Side, Spotlight,
143        Tooltip,
144    };
145    pub use crate::reactive::{
146        provide, use_context, use_form, use_state, watch, FormState, Signal,
147    };
148    pub use crate::{Collapse, Transition, TransitionKind};
149    pub use crate::{Badge, Button, Card, Divider, Paper, Text, Title};
150    pub use crate::{WebView, WebViewEvent};
151}