Expand description
The prelude of this crate. When building UI in this app you almost always want to import this.
Re-exports§
pub use crate::DynamicSpacing;pub use crate::tab_switcher_preview;pub use crate::terminal_panel_preview;pub use crate::terminal_view_preview;pub use crate::ActionPanel;pub use crate::Alert;pub use crate::AlertDialog;pub use crate::AppShell;pub use crate::AspectRatio;pub use crate::Badge;pub use crate::BadgeColor;pub use crate::BadgeVariant;pub use crate::Breadcrumb;pub use crate::BreadcrumbItem;pub use crate::CalendarPreview;pub use crate::Card;pub use crate::CardVariant;pub use crate::CarouselPreview;pub use crate::Chart;pub use crate::ChartKind;pub use crate::Checkbox;pub use crate::CodeEditor;pub use crate::Combobox;pub use crate::Command;pub use crate::CommandPalette;pub use crate::CommandPaletteItem;pub use crate::Container;pub use crate::DatePickerPreview;pub use crate::DescriptionList;pub use crate::DescriptionListMode;pub use crate::Drawer;pub use crate::EmptyState;pub use crate::Feed;pub use crate::FileInput;pub use crate::Form;pub use crate::FormField;pub use crate::HoverCard;pub use crate::InputGroup;pub use crate::InputOtp;pub use crate::Item;pub use crate::Kbd;pub use crate::LayoutTable;pub use crate::LayoutTableBody;pub use crate::LayoutTableCaption;pub use crate::LayoutTableCell;pub use crate::LayoutTableHead;pub use crate::LayoutTableHeader;pub use crate::LayoutTableRow;pub use crate::MediaObject;pub use crate::Menubar;pub use crate::MultiSelect;pub use crate::PageHeading;pub use crate::Pagination;pub use crate::Pane;pub use crate::PaneGroup;pub use crate::PaneGroupPreview;pub use crate::RadioButton;pub use crate::ResizablePreview;pub use crate::SearchInput;pub use crate::SectionHeading;pub use crate::SegmentedControl;pub use crate::Select;pub use crate::SheetSide;pub use crate::Sidebar;pub use crate::SidebarItem;pub use crate::Skeleton;pub use crate::Slider;pub use crate::SonnerStackPreview;pub use crate::Spinner;pub use crate::StatsCard;pub use crate::StatsTrend;pub use crate::Stepper;pub use crate::StepperStep;pub use crate::Switch;pub use crate::TabSwitcher;pub use crate::TabSwitcherItem;pub use crate::TerminalPanel;pub use crate::TerminalView;pub use crate::TextInput;pub use crate::Textarea;pub use crate::TitleBar;pub use crate::ToastStack;pub use crate::ToggleGroup;pub use crate::ToggleGroupItem;pub use crate::ToggleGroupMode;pub use crate::Button;pub use crate::ButtonGroup;pub use crate::ButtonSize;pub use crate::ButtonSizeAlias;pub use crate::ButtonStyle;pub use crate::ButtonVariant;pub use crate::IconButton;pub use crate::SelectableButton;pub use crate::ButtonCommon;pub use crate::Color;pub use crate::CannotRemoveLastPane;pub use crate::ClosePane;pub use crate::FocusDown;pub use crate::FocusLeft;pub use crate::FocusRight;pub use crate::FocusUp;pub use crate::Member;pub use crate::PaneAxis;pub use crate::SplitDirection;pub use crate::SplitDown;pub use crate::SplitLeft;pub use crate::SplitRight;pub use crate::SplitUp;pub use crate::TabContent;pub use crate::TabId;pub use crate::register_pane_keybindings;pub use crate::Headline;pub use crate::HeadlineSize;pub use crate::Icon;pub use crate::IconPosition;pub use crate::IconSize;pub use crate::Label;pub use crate::LabelCommon;pub use crate::LabelSize;pub use crate::LineHeightStyle;pub use crate::LoadingLabel;pub use crate::code_editor_preview;pub use crate::combobox_preview;pub use crate::multi_select_preview;pub use crate::search_input_preview;pub use crate::h_flex;pub use crate::v_flex;pub use crate::h_group;pub use crate::h_group_lg;pub use crate::h_group_sm;pub use crate::h_group_xl;pub use crate::v_group;pub use crate::v_group_lg;pub use crate::v_group_sm;pub use crate::v_group_xl;
Modules§
- palette
- Role-based color palette for the design system.
- semantic
- Theme-driven neutral color roles.
- styled_
ext_ reflection - Implements function reflection
Structs§
- AnyElement
- A dynamically typed element that can be used to store any element type.
- App
- Contains the state of the full application, and passed as a reference to a variety of callbacks.
Other Context derefs to this type.
You need a reference to an
Appto access the state of a Entity. - Context
- The app context, with specialized behavior for the given entity.
- Div
- A
Divelement, the all-in-one element for building complex UIs in GPUI - Pixels
- Represents a length in pixels, the base unit of measurement in the UI framework.
- Rems
- Represents a length in rems, a unit based on the font-size of the window, which can be assigned with
Window::set_rem_size. - Shared
String - A shared string is an immutable string that can be cheaply cloned in GPUI
tasks. Essentially an abstraction over an
Arc<str>and&'static str, currently backed by aSmolStr. - Window
- Holds the state for a specific window.
Enums§
- Absolute
Length - Represents an absolute length in pixels or rems.
- Animation
Direction - Animation
Duration - Component
Scope - Definite
Length - A non-auto length that can be defined in pixels, rems, or percent of parent.
- Element
Id - An identifier for an
Element. - Icon
Name - Platform
Style - The platform style to use when rendering UI.
- Severity
- Severity levels that determine the style of the component. Usually, it affects the background. Most of the time, it also follows with an icon corresponding the severity level.
- Shadow
- Named elevation levels. Values mirror the Tailwind box-shadow scale.
- Text
Size - A utility for getting the size of various semantic text sizes.
- Toggle
State - Represents the selection status of an element.
Traits§
- Active
Theme - Implementing this trait allows accessing the active theme.
- Borrow
AppContext - A helper trait for auto-implementing certain methods on contexts that can be used interchangeably.
- Clickable
- A trait for elements that can be clicked. Enables the use of the
on_clickmethod. - Component
- Implement this trait to define a UI component. This will allow you to
derive
RegisterComponenton it, in turn allowing you to preview the contents of the preview fn inworkspace: open component preview. - Default
Animations - Disableable
- A trait for elements that can be disabled. Generally used to implement disabling an element’s interactivity and changing its appearance to reflect that it is disabled.
- Element
- Implemented by types that participate in laying out and painting the contents of a window. Elements form a tree and are laid out according to web-based layout rules, as implemented by Taffy. You can create custom elements by implementing this trait, see the module-level documentation for more details.
- Fixed
Width - A trait for elements that can have a fixed with. Enables the use of the
widthandfull_widthmethods. - Fluent
Builder - A helper trait for building complex objects with imperative conditionals in a fluent style.
- Interactive
Element - A trait for elements that want to use the standard GPUI event handlers that don’t require any state.
- Into
Element - Implemented by any type that can be converted into an element.
- Parent
Element - This is a helper trait to provide a uniform interface for constructing elements that can accept any number of any kind of child elements
- Refineable
- A trait for types that can be refined with partial updates.
- Render
- An object that can be drawn to the screen. This is the trait that distinguishes “views” from
other entities. Views are
Entity’s whichimpl Renderand drawn to the screen. - Render
Once - You can derive
IntoElementon any type that implements this trait. It is used to construct reusablecomponentsout of plain data. Think of components as a recipe for a certain pattern of elements. RenderOnce allows you to invoke this pattern, without breaking the fluent builder pattern of the element APIs. - Stateful
Interactive Element - A trait for elements that want to use the standard GPUI interactivity features that require state.
- Styled
- A trait for elements that can be styled. Use this to opt-in to a utility CSS-like styling API.
- Styled
Ext - Extends
gpui::Styledwith app-specific styling methods. - Styled
Image - Style an image element.
- Styled
Shadow - Extends
gpui::Styledwith a named shadow scale. - Styled
Typography - Extends
gpui::Styledwith typography-related styling methods. - Toggleable
- A trait for elements that can be toggled.
- Visible
OnHover - A trait for elements that can be made visible on hover by tracking a specific group.
- Visual
Context - This trait is used for the different visual contexts in GPUI that require a window to be present.
- _
- The context trait, allows the different contexts in GPUI to be used interchangeably for certain operations.
Functions§
- div
- Construct a new
Divelement - example_
group - example_
group_ with_ title - focus_
ring - Wraps
contentin a gapped focus ring ofcolor, shown only whenfocused. Layout is stable across focus states. - focus_
ring_ error - Focus ring in the danger color, for invalid/error fields.
- focus_
ring_ primary - Focus ring in the primary accent color (default for inputs/buttons).
- px
- Constructs a
Pixelsvalue representing a length in pixels. - relative
- Constructs a
DefiniteLengthrepresenting a relative fraction of a parent size. - rems
- Constructs a
Remsvalue representing a length in rems. - rems_
from_ px - Returns a rem value derived from the provided pixel value and the base rem size (16px).
- single_
example - vh
- Returns a
Lengthcorresponding to the specified percentage of the viewport’s height. - vw
- Returns a
Lengthcorresponding to the specified percentage of the viewport’s width.
Derive Macros§
- Into
Element - #[derive(IntoElement)] is used to create a Component out of anything that implements
the
RenderOncetrait. - Refineable
- Register
Component - Registers components that implement the
Componenttrait. - Visual
Context - #[derive(VisualContext)] is used to create a visual context out of anything that holds a
&mut Windowand implementsAppContextNote that a#[app]and a#[window]attribute are required to identify the variables holding the &mut App, and &mut Window respectively. - _
- #[derive(AppContext)] is used to create a context out of anything that holds a
&mut AppNote that a#[app]attribute is required to identify the variable holding the &mut App.