Skip to main content

Module prelude

Module prelude 

Source
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::LayoutTableFooter;
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::Navbar;
pub use crate::NavigationMenuPreview;
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::VerticalNav;
pub use crate::VerticalNavItem;
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 App to access the state of a Entity.
Context
The app context, with specialized behavior for the given entity.
Div
A Div element, 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.
SharedString
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 a SmolStr.
Window
Holds the state for a specific window.

Enums§

AbsoluteLength
Represents an absolute length in pixels or rems.
AnimationDirection
AnimationDuration
ComponentScope
DefiniteLength
A non-auto length that can be defined in pixels, rems, or percent of parent.
ElementId
An identifier for an Element.
IconName
PlatformStyle
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.
TextSize
A utility for getting the size of various semantic text sizes.
ToggleState
Represents the selection status of an element.

Traits§

ActiveTheme
Implementing this trait allows accessing the active theme.
BorrowAppContext
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_click method.
Component
Implement this trait to define a UI component. This will allow you to derive RegisterComponent on it, in turn allowing you to preview the contents of the preview fn in workspace: open component preview.
DefaultAnimations
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.
FixedWidth
A trait for elements that can have a fixed with. Enables the use of the width and full_width methods.
FluentBuilder
A helper trait for building complex objects with imperative conditionals in a fluent style.
InteractiveElement
A trait for elements that want to use the standard GPUI event handlers that don’t require any state.
IntoElement
Implemented by any type that can be converted into an element.
ParentElement
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 which impl Render and drawn to the screen.
RenderOnce
You can derive IntoElement on any type that implements this trait. It is used to construct reusable components out 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.
StatefulInteractiveElement
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.
StyledExt
Extends gpui::Styled with app-specific styling methods.
StyledImage
Style an image element.
StyledShadow
Extends gpui::Styled with a named shadow scale.
StyledTypography
Extends gpui::Styled with typography-related styling methods.
Toggleable
A trait for elements that can be toggled.
VisibleOnHover
A trait for elements that can be made visible on hover by tracking a specific group.
VisualContext
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 Div element
example_group
example_group_with_title
focus_ring
Wraps content in a gapped focus ring of color, shown only when focused. 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 Pixels value representing a length in pixels.
relative
Constructs a DefiniteLength representing a relative fraction of a parent size.
rems
Constructs a Rems value 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 Length corresponding to the specified percentage of the viewport’s height.
vw
Returns a Length corresponding to the specified percentage of the viewport’s width.

Derive Macros§

IntoElement
#[derive(IntoElement)] is used to create a Component out of anything that implements the RenderOnce trait.
Refineable
RegisterComponent
Registers components that implement the Component trait.
VisualContext
#[derive(VisualContext)] is used to create a visual context out of anything that holds a &mut Window and implements AppContext Note 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 App Note that a #[app] attribute is required to identify the variable holding the &mut App.