Skip to main content

Crate kael

Crate kael 

Source
Expand description

§Kael

A GPU-accelerated desktop UI framework for building native applications in Rust.

Renders via Metal (macOS), DirectX 11 (Windows), and Vulkan (Linux). Apps are pure Rust with native performance and 120fps rendering through dirty tracking and render-on-demand.

Kael is a fork of GPUI, the UI framework Zed Industries built for the Zed editor. It was previously distributed as the adabraka GPUI fork and renamed to Kael. It is an independent project — not affiliated with, maintained by, or endorsed by Zed Industries.

§Quick Start

[dependencies]
kael = "0.1"
use kael::*;
use kael::prelude::*;

struct Counter { count: i32 }

impl Render for Counter {
    fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
        let entity = cx.entity().clone();
        div()
            .flex().flex_col().gap_2()
            .child(format!("Count: {}", self.count))
            .child(
                button("inc", "Increment")
                    .on_click(move |_, window, cx| {
                        entity.update(cx, |this, cx| {
                            this.count += 1;
                            cx.notify();
                        });
                    }),
            )
    }
}

fn main() {
    Application::new().run(|cx| {
        cx.open_window(WindowOptions::default(), |_, cx| {
            cx.new(|_| Counter { count: 0 })
        })
        .unwrap();
    });
}

§What’s Included

  • 42+ UI primitives: Button, TextInput, Checkbox, Toggle, Slider, Select, DatePicker, Modal, Popover, Tabs, Disclosure, lists, and more
  • Flexbox layout via Taffy with responsive styling
  • Entity-based reactive state: Entity<T>, cx.new(), cx.notify(), cx.observe(), cx.subscribe()
  • Platform APIs: file dialogs, system tray, notifications, global hotkeys, printing, clipboard, auto-updates, WebViews
  • Theming: JSON/TOML themes with hot-reload
  • Accessibility: screen reader roles, keyboard navigation, focus management
  • Animation: keyframe and spring animations, Lottie playback
  • Canvas: stroked/filled paths, shapes, transforms
  • Plugin system: WASM-sandboxed extensions

§Platform Support

PlatformRendererStatus
macOSMetalFull support
Linux (X11)VulkanFull support
Linux (Wayland)VulkanFull support
WindowsDirectX 11Full support

§Documentation

§Acknowledgements

Kael began as a fork of GPUI, the GPU-accelerated UI framework originally created by Zed Industries for the Zed code editor — and was previously distributed as the adabraka GPUI fork. We are grateful for their foundational work. The original GPUI code is copyright 2022-2025 Zed Industries, Inc. and licensed under Apache-2.0. Kael is an independent project and is not affiliated with or endorsed by Zed Industries.

§License

Apache-2.0 — see LICENSE for details.

Re-exports§

pub use command_registry::CommandDescriptor;
pub use command_registry::CommandPalette;
pub use command_registry::PaletteCommandId;
pub use crate::animation::Animation;
pub use crate::animation::AnimationSequence;
pub use crate::animation::Easing;
pub use crate::animation::Keyframes;
pub use crate::animation::Repeat;
pub use crate::animation::StyledKeyframe;
pub use crate::animation::keyframes;
pub use http_client;
pub use accessibility::*;
pub use app_runtime::*;
pub use background_jobs::*;
pub use benchmark::*;
pub use dev_tools::*;
pub use crate::animation::easing::*;
pub use extension_host::*;
pub use extension_rpc::*;
pub use gesture::*;
pub use gpu::*;
pub use headless_render::*;
pub use ipc_transport::*;
pub use media_capture::*;
pub use panels::*;
pub use platform_caps::*;
pub use plugin::*;
pub use process_model::*;
pub use runtime::*;
pub use scene_graph::*;
pub use security::*;
pub use split_pane::*;
pub use status_bar::*;
pub use supervisor::*;
pub use text_engine::*;
pub use theme::*;
pub use video_color::*;
pub use virtual_data::*;
pub use worker_api::*;
pub use workspace::*;

Modules§

_ownership_and_data_flow
In GPUI, every model or view in the application is actually owned by a single top-level object called the App. When a new entity or view is created (referred to collectively as entities), the application is given ownership of their state to enable their participation in a variety of app services and interaction with other entities.
accessibility
Shared accessibility model and semantic role system for GPUI.
animation
Explicit animation primitives and keyframe builders.
app_runtime
Higher-level app-runtime primitives for common desktop product patterns.
background_jobs
Background job orchestration with worker-pool integration.
benchmark
Product-level benchmark workloads and harness for GPUI.
colors
The default colors used by GPUI.
command_registry
Command registry for registering named commands invokable from menus, keybindings, and a command palette.
dev_tools
Developer tools for observability, diagnostics, and runtime inspection.
extension_host
Extension host runtime managing the full lifecycle of extensions.
extension_rpc
Extension RPC contract and typed transport wrappers.
gesture
Gesture recognizers and higher-level pointer interaction types.
golden
GPU memory budgeting and eviction. Golden-image pixel-diff comparison for the headless render pipeline. Golden-image pixel-diff comparison for the headless render pipeline (P0-J).
gpu
GPU memory budgeting and eviction.
headless_render
Headless off-screen rendering for benchmarks and golden-image tests. Headless off-screen rendering for benchmarks and golden-image tests.
inspector_reflection
Provides definitions used by #[derive_inspector_reflection].
ipc_transport
Cross-platform IPC transport for the GPUI process-isolation model.
media_capture
Cross-platform media and capture infrastructure for GPUI.
panels
Pre-built panel implementations for common dock areas.
platform_caps
Platform capability detection and feature-level support reporting.
plugin
Plugin and extension architecture for GPUI.
prelude
The GPUI prelude is a collection of traits and types that are widely used throughout the library. It is recommended to import this prelude into your application to avoid having to import each trait individually.
process_model
Process-isolation model and typed IPC for GPUI.
runtime
Runtime worker support. Runtime worker support for background task execution.
scene_graph
Scene graph primitives for canvas and creative applications. Scene graph primitives for canvas and creative applications.
scroll_bar
Scroll bar primitives bound to scroll handles.
security
Security boundary: capability model and permission broker for GPUI.
single_instance
Cross-platform single instance enforcement using Unix domain sockets and Windows named mutexes.
split_pane
Split-pane and tab model for IDE-style workspace layouts.
status_bar
Status bar for displaying contextual information in large applications.
styled_reflection
Implements function reflection
supervisor
Process supervisor for the GPUI process-isolation model.
tab_manager
Cross-platform window tab manager for Windows and Linux backends.
text_engine
Text and document editing engine for IDEs, notes apps, and chat composers.
theme
Application themes with JSON or TOML loading and file hot-reload support.
video_color
Video color: YCbCr→RGB matrices and transfer functions. Video color: YCbCr→RGB matrices and transfer functions.
virtual_data
Virtualized data models for lists, tables, and trees.
window_positioner
Pure Rust utility for computing window bounds from a semantic WindowPosition.
worker_api
Worker API for runtime tasks.
workspace
Workspace and panel layout management with JSON persistence.

Macros§

actions
Defines and registers unit structs that can be used as actions. For more complex data types, derive Action.
border_style_methods
Generates methods for border styles.
box_shadow_style_methods
Generates methods for box shadow styles.
cursor_style_methods
Generates methods for cursor styles.
include_lottie
Embed a Lottie asset directly into the binary at compile time.
margin_style_methods
Generates methods for margin styles.
overflow_style_methods
Generates methods for overflow styles.
padding_style_methods
Generates methods for padding styles.
position_style_methods
Generates methods for position styles.
register_action
This can be used to register an action with the GPUI runtime when you want to manually implement the Action trait. Typically you should use the Action derive macro or actions! macro instead.
visibility_style_methods
Generates methods for visibility styles.

Structs§

Anchored
An anchored element that can be used to display UI that will avoid overflowing the window bounds.
AnchoredState
The state that the anchored element element uses to track its children.
AnimationElement
A GPUI element that applies an animation to another element
AnimationHandle
A handle that can be used to cancel an in-flight animation.
AnyDrag
Contains state associated with an active drag operation, started by dragging an element within the window or by dragging into the app from the underlying platform.
AnyElement
A dynamically typed element that can be used to store any element type.
AnyEntity
A dynamically typed reference to a entity, which can be downcast into a Entity<T>.
AnyImageCache
A dynamically typed image cache, which can be used to store any image cache
AnyTooltip
Contains state associated with a tooltip. You’ll only need this struct if you’re implementing tooltip behavior on a custom element. Otherwise, use Div::tooltip.
AnyView
A dynamically-typed handle to a view, which can be downcast to a Entity for a specific type.
AnyWeakEntity
A type erased, weak reference to a entity.
AnyWeakView
A weak, dynamically-typed view handle that does not prevent the view from being released.
AnyWindowHandle
A handle to a window with any root view type, which can be downcast to a window with a specific root view 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.
Application
A reference to a GPUI application, typically constructed in the main function of your app. You won’t interact with this type much outside of initial configuration and startup.
ArenaClearNeeded
Returned when the element arena has been used and so must be cleared before the next draw.
AsyncApp
An async-friendly version of App with a static lifetime so it can be held across await points in async code. You’re provided with an instance when calling App::spawn, and you can also create one with App::to_async. Internally, this holds a weak reference to an App, so its methods are fallible to protect against cases where the App is dropped.
AsyncWindowContext
A cloneable, owned handle to the application context, composed with the window associated with the current task.
AutoUpdater
The auto-updater.
AutoUpdaterConfig
Configuration for the auto-updater.
Background
A background color, which can be a solid color, linear gradient, radial gradient, or conic gradient.
BackgroundExecutor
A pointer to the executor that is currently running, for spawning background tasks.
Backspace
Delete the current selection or the grapheme before the caret.
BindingIndex
Index of a binding within a keymap.
Boundary
A boundary between two lines of text.
Bounds
Represents a rectangular area in a 2D space with an origin point and a size.
BoundsRefinement
A refinable version of [#ident], see that documentation for details.
BoxShadow
The possible values of the box-shadow property
Button
A focusable button primitive backed by div click semantics.
ButtonRenderState
Snapshot of button state passed to a custom renderer.
Cached
A cache wrapper that replays a previously rendered child subtree when its dependencies are unchanged.
Canvas
A canvas element, meant for accessing the low level paint API without defining a whole custom element
CanvasDraw
A canvas element backed by an immediate-mode DrawContext.
Capslock
The state of the capslock key at some point in time
Cascade
A cascade of refinements that can be merged in priority order.
CascadeSlot
A handle to a specific slot in a cascade.
Checkbox
A controlled checkbox form control.
CheckboxRenderState
Snapshot of checkbox state passed to a custom renderer.
ClipboardItem
A clipboard item that should be copied to the clipboard
ClipboardString
A clipboard item that should be copied to the clipboard
ContentMask
Indicates which region of the window is visible. Content falling outside of this mask will not be rendered. Currently, only rectangular content masks are supported, but we give the mask its own type to leave room to support more complex shapes in the future.
Context
The app context, with specialized behavior for the given entity.
ContextEntry
An entry in a KeyContext
ContextMenu
A builder for structured in-window context menus.
Copy
Copy the selected text to the clipboard.
Corners
Represents the corners of a box in a 2D space, such as border radius.
CornersRefinement
A refinable version of [#ident], see that documentation for details.
CrashReport
Information collected for a crash report.
CrashReporter
A crash reporter that captures Rust panics, persists them to disk, and attempts to submit them on the next launch.
Cut
Cut the selected text to the clipboard.
DatePicker
A controlled date picker with a popup month grid.
DatePickerDayRenderState
Snapshot of a calendar day cell passed to a custom renderer.
DatePickerHeaderRenderState
Snapshot of the calendar header passed to a custom renderer.
DatePickerNavButtonRenderState
Snapshot of a month navigation button passed to a custom renderer.
DatePickerPopupRenderState
Snapshot of date picker popup state passed to a custom renderer.
DatePickerRenderState
Snapshot of date picker trigger state passed to a custom renderer.
DatePickerWeekdayRenderState
Snapshot of a weekday label passed to a custom renderer.
DebugBelow
Use this struct for interfacing with the ‘debug_below’ styling from your own elements. If a parent element has this style set on it, then this struct will be set as a global in GPUI.
DecorationRun
Set the text decoration for a run of text.
Deferred
An element which delays the painting of its child until after all of its ancestors, while keeping its layout as part of the current element tree.
DeferredScrollToItem
Delete
Delete the current selection or the grapheme after the caret.
DeleteWordBackward
Delete from the caret to the previous word boundary.
DeleteWordForward
Delete from the caret to the next word boundary.
DevicePixels
Represents physical pixels on the display.
DialogOptions
Options for displaying a native dialog.
Disclosure
A controlled disclosure primitive with caller-owned trigger visuals and panel content.
DisclosureRenderState
Snapshot of disclosure trigger state passed to a custom renderer.
DismissEvent
Emitted by implementers of ManagedView to indicate the view should be dismissed, such as when a view is presented as a modal.
DisplayId
An opaque identifier for a hardware display
Div
A Div element, the all-in-one element for building complex UIs in GPUI
DivFrameState
A frame state for a Div element, which contains layout IDs for its children.
DivInspectorState
Interactivity state displayed an manipulated in the inspector.
DivPrepaintState
Prepaint state for a div.
DownloadProgress
Progress information during an update download.
DragMoveEvent
An event for when a drag is moving over this element, with the given state type.
DrawContext
Immediate-mode drawing context used by canvas(size, draw).
Drawable
A wrapper around an implementer of Element that allows it to be drawn in a window.
DummyKeyboardMapper
A dummy implementation of the platform keyboard mapper
Edges
Represents the edges of a box in a 2D space, such as padding or margin.
EdgesRefinement
A refinable version of [#ident], see that documentation for details.
ElementClickedState
Whether or not the element or a group that contains it is clicked by the mouse.
ElementInputHandler
The canonical implementation of PlatformInputHandler. Call Window::handle_input with an instance during your element’s paint.
Empty
The empty element, which renders nothing.
EmptyView
A view that renders nothing
Entity
A strong, well-typed reference to a struct which is managed by GPUI
EntityId
A unique identifier for a entity across the application.
ExternalPaths
A collection of paths from the platform, such as from a file drop.
FallbackPromptRenderer
The default GPUI fallback for rendering prompts, when the platform doesn’t support it.
FileWatchOptions
Options that control how a path is watched.
FileWatcher
Cross-platform file-system watcher backed by the notify crate.
FillOptions
Parameters for the fill tessellator.
FocusHandle
A handle which can be used to track and manipulate the focused element in a window.
FocusId
A globally unique identifier for a focusable element.
FocusOutEvent
This is provided when subscribing for Context::on_focus_out events.
FocusedWindowInfo
Information about the currently focused window from any application.
Font
The configuration details for identifying a specific font.
FontFallbacks
The fallback fonts that can be configured for a given font. Fallback fonts family names are stored here.
FontFamilyId
An opaque identifier for a specific font family.
FontFeature
A single OpenType font feature tag with its value.
FontFeatures
The OpenType features that can be configured for a given font.
FontId
An opaque identifier for a specific font.
FontMetrics
A struct for storing font metrics. It is used to define the measurements of a typeface.
FontRun
A run of text with a single font.
FontWeight
The degree of blackness or stroke thickness of a font. This value ranges from 100.0 to 900.0, with 400.0 as normal.
ForegroundExecutor
A pointer to the executor that is currently running, for spawning tasks on the main thread.
GlobalElementId
A globally unique identifier for an element, used to track state across frames.
GlyphId
An identifier for a specific glyph, as returned by WindowTextSystem::layout_line.
GpuSpecs
Information about the GPU GPUI is running on.
GpuiBorrow
A mutable reference to an entity owned by GPUI
GridLocation
A location in a grid layout.
GroupStyle
The styling information for a given group.
HighlightStyle
A highlight style to apply, similar to a TextStyle except for a single font, uniformly sized and spaced text.
Hitbox
A rectangular region that potentially blocks hitboxes inserted prior. See Window::insert_hitbox for more details.
HitboxId
An identifier for a Hitbox which also includes HitboxBehavior.
Hsla
An HSLA color
Icon
An icon element backed by the generated build-time icon atlas.
Image
An image, with a format and certain bytes
ImageCacheElement
An image cache element.
ImageFormatIter
An iterator over the variants of ImageFormat
ImageId
A unique identifier for the image cache
ImageStyle
The style of an image element.
Img
An image element.
ImgLayoutState
The image layout state between frames
InsertNewline
Insert a newline in multiline mode or submit in single-line mode.
Inspector
Manages inspector state - which element is currently selected and whether the inspector is in picking mode.
InspectorElementId
A unique identifier for an element that can be inspected.
InspectorElementPath
GlobalElementId qualified by source location of element construction.
InteractiveElementState
The per-frame state of an interactive element. Used for tracking stateful interactions like clicks and scroll offsets.
InteractiveText
A text element that can be interacted with.
Interactivity
The interactivity struct. Powers all of the general-purpose interactivity in the Div element.
InvalidKeystrokeError
Error type for Keystroke::parse. This is used instead of anyhow::Error so that Kael can use markdown to display it.
ItemSize
The size of the item and its contents.
KeyBinding
A keybinding and its associated metadata, from the keymap.
KeyBindingMetaIndex
A unique identifier for retrieval of metadata associated with a key binding. Intended to be used as an index or key into a user-defined store of metadata associated with the binding, such as the source of the binding.
KeyContext
A datastructure for resolving whether an action should be dispatched at this point in the element tree. Contains a set of identifiers and/or key value pairs representing the current context for the keymap.
KeyDownEvent
The key down event equivalent for the platform.
KeyUpEvent
The key up event equivalent for the platform.
KeybindingKeystroke
Represents a keystroke that can be used in keybindings and displayed to the user.
KeyboardClickEvent
A click event that was generated by a keyboard button being pressed and released.
Keymap
A collection of key bindings for the user’s application.
KeymapVersion
An opaque identifier of which version of the keymap is currently active. The keymap’s version is changed whenever bindings are added or removed.
Keystroke
A keystroke and associated metadata generated by the platform
KeystrokeEvent
A keystroke event, and potentially the associated action
Label
A text label primitive that can forward focus to another control when clicked.
LayerAnchor
Anchored placement configuration for a layer.
LayerId
A stable identifier for a layer managed by LayerStack.
LayerOptions
Options that control how a layer behaves inside a LayerStack.
LayerStack
A stack of in-window layers such as modals and popovers.
LayoutId
A unique identifier for a layout node, generated when requesting a layout from Taffy
LineLayout
A laid out and styled line of text
LineWrapper
The GPUI line wrapper, used to wrap lines of text to a given width.
LineWrapperHandle
A handle into the text system, which can be used to compute the wrapped layout of text
LinearColorStop
A color stop in a linear gradient.
Link
A focusable hyperlink primitive with built-in external URL support.
LinuxInstaller
Linux installer: handles AppImage delta updates, Flatpak, and Snap update channels.
List
A list element
ListOffset
An offset into the list’s items, in terms of the item index and the number of pixels off the top left of the item.
ListPrepaintState
Frame state used by the List element after layout.
ListScrollEvent
A scroll event that has been converted to be in terms of the list’s items.
ListState
The list state that views must hold on behalf of the list element.
Lottie
A Lottie animation element.
LottieAnimation
Parsed Lottie animation metadata and source bytes.
LottiePlayer
Playback controller for a decoded Lottie animation.
MagnifyEvent
A magnification gesture event from the platform.
Menu
A menu of the application, either a main menu or a submenu
MenuButton
A popup-backed menu button with caller-owned trigger and item visuals.
MenuButtonItem
A single popup menu item.
MenuButtonItemRenderState
Snapshot of a popup menu item row passed to a custom renderer.
MenuButtonTriggerRenderState
Snapshot of menu button trigger state passed to a custom renderer.
MenuEntry
A focusable menu item primitive with caller-owned visuals.
Modal
A controlled modal primitive with caller-owned dialog visuals.
ModalRenderState
Snapshot of modal state passed to a custom renderer.
Modifiers
The state of the modifier keys at some point in time
ModifiersChangedEvent
The modifiers changed event equivalent for the platform.
MouseClickEvent
A click event, generated when a mouse button is pressed and released.
MouseDownEvent
A mouse down event from the platform
MouseExitEvent
A mouse exit event from the platform, generated when the mouse leaves the window.
MouseMoveEvent
A mouse move event from the platform
MouseUpEvent
A mouse up event from the platform
MoveLeft
Move the caret one grapheme to the left.
MoveRight
Move the caret one grapheme to the right.
MoveToEnd
Move the caret to the end of the field.
MoveToStart
Move the caret to the beginning of the field.
MoveWordLeft
Move the caret to the previous word boundary.
MoveWordRight
Move the caret to the next word boundary.
Navigator
A renderable navigation stack that supports animated route transitions.
NoAction
Action with special handling which unbinds the keybinding this is associated with, if it is the highest precedence match.
NotificationAction
A notification action button.
OsInfo
Information about the operating system.
OsMenu
OS menus are menus that are recognized by the operating system This allows the operating system to provide specialized items for these menus
OwnedMenu
A menu of the application, either a main menu or a submenu
OwnedOsMenu
OS menus are menus that are recognized by the operating system This allows the operating system to provide specialized items for these menus
PaintQuad
A rectangle to be rendered in the window at the given position and size. Passed as an argument Window::paint_quad.
Paste
Paste clipboard text into the field.
Path
A line made up of a series of vertices and control points.
PathBuilder
A Path builder.
PathPromptOptions
The options that can be configured for a file dialog prompt
Percentage
A type representing a percentage value.
PixelSnapPolicy
Consistent pixel-snapping helper for fills, strokes, clips, and text baselines.
Pixels
Represents a length in pixels, the base unit of measurement in the UI framework.
Point
Describes a location in a 2D cartesian space.
PointRefinement
A refinable version of [#ident], see that documentation for details.
Popover
A controlled anchored popover with caller-owned anchor and popup visuals.
PopoverAnchorRenderState
Snapshot of popover anchor state passed to a custom renderer.
PopoverPopupRenderState
Snapshot of popover popup state passed to a custom renderer.
PrintContext
A recording context for one printed page.
PrintImageStyle
Image layout settings for print image commands.
PrintJob
A print job that can be sent directly to the platform printer or shown in a native print dialog.
PrintPage
A single page in a print job.
PrintStroke
Stroke settings for line drawing commands.
PrintTextStyle
Text styling for print text commands.
Progress
A styled progress indicator with caller-owned rendering.
ProgressRenderState
Snapshot of progress state passed to a custom renderer.
PromptHandle
A handle to a prompt that can be used to interact with it.
PromptResponse
The event emitted when a prompt’s option is selected. The usize is the index of the selected option, from the actions passed to the prompt.
Radians
Represents an angle in Radians
RadioGroup
A controlled radio group form control.
RadioItemRenderState
Snapshot of a single radio option passed to a custom renderer.
RadioOption
A single labeled option in a radio group.
RecyclingList
A keyed heterogeneous list that recycles layout state across frames.
RecyclingListFrameState
Frame state used by a RecyclingList between prepaint and paint.
Redo
Reapply the next edit snapshot.
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.
RenderImage
A cached and processed image, in BGRA format
RenderablePromptHandle
A prompt handle capable of being rendered in a window.
Reservation
Returned by Context::reserve_entity to later be passed to Context::insert_entity. Allows you to obtain the EntityId for a entity before it is created.
ResizeEvent
An event that fires when an element’s bounds change size.
RetainAllImageCache
An implementation of ImageCache, that uses an LRU caching strategy to unload images when the cache is full
RetainAllImageCacheProvider
A provider struct for creating a retain-all image cache inline
Rgba
An RGBA color
RichText
A builder-backed rich text element for styled content, entities, and inline children.
RichTextLayout
A tracked layout handle for rich text geometry and selection queries.
Route
A route rendered by a Navigator.
RouteChangeEvent
An event emitted whenever the active route changes.
ScaledPixels
Represents scaled pixels that take into account the device’s scale factor.
Scope
Scope manages a set of tasks that are enqueued and waited on together. See BackgroundExecutor::scoped.
ScreenCaptureFrame
A frame of video captured from a screen.
ScrollAnchor
Represents an element that can be scrolled to in its parent element. Contrary to ScrollHandle::scroll_to_active_item, an anchored element does not have to be an immediate child of the parent.
ScrollBar
A focusable scroll bar primitive bound to a scrollable container.
ScrollBarRenderState
Snapshot of scroll bar state passed to a custom renderer.
ScrollHandle
A handle to the scrollable aspects of an element. Used for accessing scroll state, like the current scroll offset, and for mutating the scroll state, like scrolling to a specific child.
ScrollWheelEvent
A mouse wheel event from the platform
Select
A controlled popup-backed combo box.
SelectAll
Select all text in the field.
SelectLeft
Extend the selection one grapheme to the left.
SelectOption
A single labeled option in a select control.
SelectOptionRenderState
Snapshot of a popup option row passed to a custom renderer.
SelectPopupRenderState
Snapshot of select popup state passed to a custom popup renderer.
SelectRenderState
Snapshot of select trigger state passed to a custom renderer.
SelectRight
Extend the selection one grapheme to the right.
SelectSearchRenderState
Snapshot of the in-popup search field passed to a custom renderer.
SelectToEnd
Extend the selection to the end of the field.
SelectToStart
Extend the selection to the beginning of the field.
SelectWordLeft
Extend the selection to the previous word boundary.
SelectWordRight
Extend the selection to the next word boundary.
SemanticVersion
A semantic version number.
SessionSnapshot
A persisted snapshot of the entire session.
SessionStore
Persistent storage for application session state.
ShapedGlyph
A single glyph, ready to paint.
ShapedLine
A line of text that has been shaped and decorated.
ShapedRun
A run of text that has been shaped .
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,
SharedUri
A SharedString containing a URI.
Size
A structure representing a two-dimensional size with width and height in a given unit.
SizeRefinement
A refinable version of [#ident], see that documentation for details.
Slider
A controlled slider form control.
SliderRenderState
Snapshot of slider state passed to a custom renderer.
SortableList
A list component that supports reordering its own items via drag and drop.
SourceMetadata
Metadata for a given ScreenCaptureSource
Splitter
A controlled splitter primitive with caller-owned visuals.
SplitterRenderState
Snapshot of splitter state passed to a custom renderer.
Stateful
A wrapper around an element that can store state, produced after assigning an ElementId.
StrikethroughStyle
The properties that can be applied to a strikethrough.
StrikethroughStyleRefinement
A refinable version of [#ident], see that documentation for details.
Stroke
Stroke styling for immediate-mode canvas drawing.
StrokeDash
Stroke dash settings for canvas stroke operations.
StrokeOptions
Parameters for the tessellator.
Style
The CSS styling that can be applied to an element via the Styled trait
StyleRefinement
A refinable version of [#ident], see that documentation for details.
StyledText
Renders text with runs of different styles.
Submit
Submit the current field value.
Subscription
A handle to a subscription created by GPUI. When dropped, the subscription is cancelled and the callback will no longer be invoked.
Surface
A surface element.
Svg
An SVG element.
SystemWindowTabController
A controller for managing window tabs.
TabItem
A single tab item with a label and panel body.
TabRenderState
Snapshot of a tab trigger passed to a custom renderer.
Tabs
A controlled tabs primitive with caller-owned tab bodies and panels.
Task
Task is a primitive that allows work to happen in the background.
TaskLabel
A task label is an opaque identifier that you can use to refer to a task in tests.
TextInput
A controlled editable text field.
TextInputRenderLine
A single shaped line and its paint origin for a custom text input renderer.
TextInputRenderState
Snapshot of text input paint state passed to a custom renderer.
TextLayout
The Layout for TextElement. This can be used to map indices to pixels and vice versa.
TextRun
A styled run of text, for use in crate::TextLayout.
TextShadow
A shadow effect applied to text, rendered by painting glyphs twice.
TextStyle
The properties that can be used to style text in GPUI
TextStyleRefinement
A refinable version of [#ident], see that documentation for details.
TextSystem
The GPUI text rendering sub system.
Tiling
A type to describe which sides of the window are currently tiled in some way
Timeout
Error returned by with_timeout when the timeout duration elapsed before the future resolved
Timer
A future or stream that emits timed events.
TitlebarOptions
The options that can be configured for a window’s titlebar
Toast
Configuration for a single toast notification.
ToastStack
A stack of toast notifications that manages display and auto-dismissal.
Toggle
A controlled toggle switch form control.
ToggleRenderState
Snapshot of toggle state passed to a custom renderer.
TooltipId
An identifier for a tooltip.
TraceEvent
A single trace event compatible with the Chrome Trace Event format.
Tracer
A tracer that collects trace events and can export them in Chrome Trace Event format.
Transformation
A transformation to apply to an SVG element.
TransformationMatrix
A data type representing a 2 dimensional transformation that can be applied to an element.
TreeItem
A focusable tree item primitive with controlled selected and expanded state.
UTF16Selection
A struct representing a selection in a text buffer, in UTF16 characters. This is different from a range because the head may be before the tail.
UnderlineStyle
The properties that can be applied to an underline.
UnderlineStyleRefinement
A refinable version of [#ident], see that documentation for details.
Undo
Restore the previous edit snapshot.
UniformList
A list element for efficiently laying out and displaying a list of uniform-height elements.
UniformListFrameState
Frame state used by the UniformList.
UniformListScrollHandle
A handle for controlling the scroll position of a uniform list. This should be stored in your view and passed to the uniform_list on each frame.
UniformListScrollState
UpdateInfo
Information about an available update.
WeakEntity
A weak reference to a entity of the given type.
WeakFocusHandle
A weak reference to a focus handle.
WebView
A native embedded WebView element.
Window
Holds the state for a specific window.
WindowControls
What window controls this platform supports
WindowHandle
A handle to a window with a specific root view type. Note that this does not keep the window alive on its own.
WindowId
A unique identifier for a window.
WindowOptions
The variables that can be configured when creating a new window
WindowState
A snapshot of a window’s state for save/restore.
WindowTextSystem
The GPUI text layout subsystem.
WrapBoundary
A boundary at which a line was wrapped
WrappedLine
A line of text that has been shaped, decorated, and wrapped by the text layout system.
WrappedLineLayout
A line of text that has been wrapped to fit a given width

Enums§

AbsoluteLength
Represents an absolute length in pixels or rems.
ActionBuildError
Error type for Keystroke::parse. This is used instead of anyhow::Error so that Kael can use markdown to display it.
AlignContent
Sets the distribution of space between and around content items For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
AlignItems
Used to control how child nodes are aligned. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
AnchoredFitMode
Which algorithm to use when fitting the anchored element to be inside the window.
AnchoredPositionMode
Which algorithm to use when positioning the anchored element.
ArcCow
AssetLogger
An asset Loader which logs the Err variant of a Result during loading
AttentionType
The type of user attention to request from the OS.
AvailableSpace
The space available for an element to be laid out in
Axis
Axis in a 2D cartesian space.
BiometricKind
The kind of biometric authentication available.
BiometricStatus
The availability status of biometric authentication.
BlendMode
The blend mode to apply when rendering a quad.
BorderStyle
The style of a border.
ClickEvent
A click event, generated when a mouse button or keyboard button is pressed and released.
ClipboardEntry
Either a ClipboardString or a ClipboardImage
ColorSpace
A color space for color interpolation.
Corner
Identifies a corner of a 2d box.
CursorStyle
The style of the cursor (pointer)
DatePickerNavigationDirection
Direction of a date picker navigation button.
Decorations
A type to describe how this window is currently configured
DefiniteLength
A non-auto length that can be defined in pixels, rems, or percent of parent.
DialogKind
The kind of a native dialog.
DispatchPhase
Represents the two different phases when dispatching events.
Display
Sets the layout used for the children of this node
ElementId
An identifier for an Element.
FileDropEvent
A file drop event from the platform, generated when files are dragged and dropped onto the window.
FileWatchEvent
A file-system change delivered by FileWatcher.
Fill
The kinds of fill that can be applied to a shape.
FillRule
The fill rule defines how to determine what is inside and what is outside of the shape.
FlexDirection
The direction of the flexbox layout main axis.
FlexWrap
Controls whether flex items are forced onto one line or can wrap onto multiple lines.
FontStyle
Allows italic or oblique faces to be selected.
GridPlacement
The placement of an item within a grid layout’s column or row.
HitboxBehavior
How the hitbox affects mouse behavior.
ImageAssetLoader
An image loader for the GPUI asset system
ImageCacheError
An error that can occur when interacting with the image cache.
ImageCacheItem
An image cache item
ImageFormat
One of the editor’s supported image formats (e.g. PNG, JPEG) - used when dealing with images in the clipboard
ImageSource
A source of image content.
KeyBindingContextPredicate
A datastructure for resolving whether an action should be dispatched Representing a small language for describing which contexts correspond to which actions.
KeyboardButton
An enum representing the keyboard button that was pressed for a click event.
LayerPlacement
Controls how a layer is placed inside a LayerStack.
Length
A length that can be defined in pixels, rems, percent of parent, or auto.
LineCap
Line cap as defined by the SVG specification.
LineFragment
A fragment of a line that can be wrapped.
LineJoin
Line join as defined by the SVG specification.
LinuxPackageFormat
Supported Linux packaging formats for auto-update.
ListAlignment
Whether the list is scrolling from top to bottom or bottom to top.
ListHorizontalSizingBehavior
The horizontal sizing behavior to apply during layout.
ListSizingBehavior
The sizing behavior to apply during layout.
LoopMode
The loop policy used by a Lottie player.
LottieAssetLoader
Asset loader for decoded Lottie animations.
LottieAssetSource
Internal asset-cache key used for Lottie resource loading.
LottieError
An error that can occur when loading or rendering a Lottie animation.
LottieSource
A source of Lottie animation content.
MediaKeyEvent
Media key events from hardware media keys or OS media controls.
MenuItem
The different kinds of items that can be in a menu
MouseButton
An enum representing the mouse button that was pressed.
NavigationDirection
A navigation direction, such as back or forward.
NavigationPolicy
Controls whether a WebView navigation attempt should continue.
NetworkStatus
The current network connectivity status.
ObjectFit
How to fit the image into the bounds of the element.
OsAction
OS actions are actions that are recognized by the operating system This allows the operating system to provide specialized behavior for these actions
Overflow
How children overflowing their container should affect layout
OwnedMenuItem
The different kinds of items that can be in a menu
PathStyle
Style of the PathBuilder
PermissionStatus
The status of a system permission.
PlatformInput
An enum corresponding to all kinds of platform input events.
PlaybackState
The playback state for a Lottie animation.
Position
The positioning strategy for this item.
PowerMode
The system’s current power policy.
PowerSaveBlockerKind
The kind of power save blocker to create.
PrintImageFit
How to fit an image into a print image bounds rectangle.
PrintOrientation
Orientation metadata for a print job.
ProgressBarState
The state of a taskbar/dock progress bar for a window.
PromptButton
Prompt Button
PromptLevel
What kind of prompt styling to show
ResizeEdge
Which part of the window to resize
Resource
An enum representing
ScrollDelta
The scroll delta for a scroll wheel event.
ScrollStrategy
Where to place the element scrolled to.
SurfaceSource
A source of a surface’s content.
SystemMenuType
The type of system menu
SystemPowerEvent
System power state change events.
TextAlign
How to align text within the element
TextOverflow
How to truncate text that overflows the width of the element
ToastPosition
Position where toasts appear on screen.
TouchPhase
The phase of a touch motion event. Based on the winit enum of the same name.
TracePhase
The phase of a trace event in the Chrome Trace Event format.
Transition
A transition applied between navigation stack changes.
TrayIconEvent
Events that can occur on a system tray icon.
TrayMenuItem
A menu item for a system tray context menu.
UpdateStatus
The current state of the auto-updater.
Visibility
The value of the visibility property, similar to the CSS property visibility
WhiteSpace
How to handle whitespace in text
WindowAppearance
The appearance of the window, as defined by the operating system.
WindowBackgroundAppearance
The appearance of the background of the window itself, when there is no content or the content is transparent.
WindowBounds
Represents the status of how a window should be opened.
WindowControlArea
A type of window control area that corresponds to the platform window.
WindowDecorations
A type to describe the appearance of a window
WindowKind
The kind of window to create
WindowPosition
A semantic window position for positioning windows relative to the screen.

Constants§

KEYSTROKE_PARSE_EXPECTED_MESSAGE
Sentence explaining what keystroke parser expects, starting with “Expected …”
LOADING_DELAY
The delay before showing the loading state.
SHUTDOWN_TIMEOUT
The duration for which futures returned from Context::on_app_quit can run before the application fully quits.

Traits§

Action
Actions are used to implement keyboard-driven UI. When you declare an action, you can bind keys to the action in the keymap and listeners for that action in the element tree.
Along
A trait for accessing the given unit along a certain axis.
AnimationExt
An extension trait for adding the animation wrapper to both Elements and Components
AppContext
The context trait, allows the different contexts in GPUI to be used interchangeably for certain operations.
AsKeystroke
This is a helper trait so that we can simplify the implementation of some functions
Asset
A trait for asynchronous asset loading.
AssetSource
A source of assets for this app to use.
BorrowAppContext
A helper trait for auto-implementing certain methods on contexts that can be used interchangeably.
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.
EntityInputHandler
Implement this trait to allow views to handle textual input when implementing an editor, field, etc.
EventEmitter
A trait for tying together the types of a GPUI entity and the events it can emit.
Flatten
A flatten equivalent for anyhow Results.
Focusable
Focusable allows users of your view to easily focus it (using window.focus_view(cx, view))
FutureExt
Extensions for Future types that provide additional combinators and utilities.
Global
A marker trait for types that can be stored in GPUI’s global state.
Half
Provides a trait for types that can calculate half of their value.
ImageCache
An object that can handle the caching and unloading of images. Implementations of this trait should ensure that images are removed from all windows when they are no longer needed.
ImageCacheProvider
An object that can create an ImageCache during the render phase. See the ImageCache trait for more information.
InputEvent
An event from a platform input source.
InputHandler
Kael’s interface for handling text input from the platform’s IME system This is currently a 1:1 exposure of the NSTextInputClient API:
InputMask
A hook that can normalize a text edit before it is committed.
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.
IsEmpty
IsZero
A trait for checking if a value is zero.
KeyEvent
A key event from the platform.
ListDelegate
Supplies item counts, estimated heights, and item rendering for a RecyclingList.
ManagedView
ManagedView is a view (like a Modal, Popover, Menu, etc.) where the lifecycle of the view is handled by another view.
MouseEvent
A mouse event from the platform.
Negate
Provides a trait for types that can negate their values.
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
PlatformDisplay
A handle to a platform’s display, e.g. a monitor or laptop screen.
PlatformInstaller
Trait for platform-specific update installation.
PlatformKeyboardLayout
A trait for platform-specific keyboard layouts
PlatformKeyboardMapper
A trait for platform-specific keyboard mappings
Prompt
A prompt that can be rendered in the window.
ReadGlobal
A trait for reading a global value from the context.
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.
ScreenCaptureSource
A source of on-screen video content that can be captured.
ScreenCaptureStream
A video stream captured from a screen.
SortableDelegate
Supplies item rendering and reorder behavior for a SortableList.
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.
StyledImage
Style an image element.
TooltipContent
Accepted content sources for tooltips on interactive elements.
TransitionAnimator
Renders a custom navigation transition.
UniformListDecoration
A decoration for a UniformList. This can be used for various things, such as rendering indent guides, or other visual effects.
UpdateGlobal
A trait for updating a global value in the context.
VisualContext
This trait is used for the different visual contexts in GPUI that require a window to be present.

Functions§

alert
Construct a semantic alert container.
anchored
anchored gives you an element that will avoid overflowing the window bounds. Its children should have no margin to avoid measurement issues.
auto
Returns a Length representing an automatic length.
background_executor
Returns a background executor for the current platform.
black
Pure black in Hsla
blue
The color blue in Hsla
bounds
Create a bounds with the given origin and size
button
Construct a button primitive with caller-owned visuals.
cached
Reuses a child subtree’s previous prepaint and paint output until one of its tracked entities changes.
canvas
Construct a canvas element.
canvas_with_prepaint
Construct a canvas element from explicit prepaint and paint closures.
capture_crash_report
Capture a CrashReport from the current panic information.
checkbox
Construct a controlled checkbox form control.
combine_highlights
Combine and merge the highlights and ranges in the two iterators.
conic_gradient
Creates a conic (sweep) gradient background.
date_picker
Construct a controlled popup-backed date picker.
deferred
Builds a Deferred element, which delays the layout and paint of its child.
dialog
Construct a semantic dialog container.
disclosure
Construct a controlled disclosure primitive.
div
Construct a new Div element
fallback_prompt_renderer
Use this function in conjunction with App::set_prompt_builder to force GPUI to always use the fallback prompt renderer.
fill
Creates a filled quad with the given bounds and background color.
font
Get a Font for a given name.
generate_list_of_all_registered_actions
Generate a list of all the registered actions. Useful for transforming the list of available actions into a format suited for static analysis such as in validating keymaps, or generating documentation.
green
The color green in Hsla
guess_compositor
Return which compositor we’re guessing we’ll use. Does not attempt to connect to the given compositor
hash
Use a quick, non-cryptographically secure hash function to get an identifier from data
hsla
Construct an Hsla object from plain values
icon
Create a built-in icon element from the generated icon atlas.
image_cache
An image cache element, all its child img elements will use the cache specified by this element. Note that this could as simple as passing an Entity<T: ImageCache>
img
Create a new image element.
is_no_action
Returns whether or not this action represents a removed key binding.
label
Construct a label primitive.
linear_color_stop
Creates a new linear color stop.
linear_gradient
Creates a LinearGradient background color.
link
Construct a semantic hyperlink primitive.
list
Construct a new list element
lottie
Create a Lottie animation element.
menu
Construct a semantic menu container.
menu_button
Construct a menu button primitive backed by an anchored popup menu.
menu_item
Construct a semantic menu item primitive.
modal
Construct a controlled modal primitive.
multi_stop_linear_gradient
Creates a linear gradient with up to 4 color stops.
navigator
Creates a navigator initialized with a single route.
opaque_grey
Opaque grey in Hsla, values will be clamped to the range [0, 1]
outline
Creates a rectangle outline with the given bounds, border color, and a 1px border width
pane
Construct a semantic pane container.
parse_update_feed
Parse an update feed, auto-detecting Sparkle appcast XML vs JSON format.
pattern_slash
Creates a hash pattern background
percentage
Generate a Radian from a percentage of a full circle.
phi
Returns the Golden Ratio, i.e. ~(1.0 + sqrt(5.0)) / 2.0.
point
Constructs a new Point<T> with the given x and y coordinates.
popover
Construct a controlled anchored popover primitive.
progress
Construct a progress indicator from the current value.
px
Constructs a Pixels value representing a length in pixels.
quad
Creates a quad with the given parameters.
radial_gradient
Creates a radial gradient background.
radians
Create a Radian from a raw value
radio_group
Construct a controlled radio group from a current value and labeled options.
recycling_list
Lazily render a heterogeneous list with estimated heights for off-screen items.
red
The color red in Hsla
relative
Constructs a DefiniteLength representing a relative fraction of a parent size.
rems
Constructs a Rems value representing a length in rems.
retain_all
Constructs a retain-all image cache that uses the element state associated with the given ID.
rgb
Convert an RGB hex color code number to a color type
rgba
Convert an RGBA hex color code number to Rgba
rich_text
Creates a rich text element that supports styled spans, inline elements, and selection.
scroll_bar
Construct a scroll bar primitive bound to a scroll handle.
select
Construct a controlled combo box from the current value and labeled options.
separator
Construct a semantic separator primitive.
size
Constructs a new Size<T> with the provided width and height.
slider
Construct a controlled slider form control.
solid_background
Creates a solid background color.
sortable_list
Creates a list with built-in internal drag-and-drop reordering.
splitter
Construct a controlled splitter primitive for resizable panes.
stroke
Construct a stroke with the default cap and join settings.
surface
Create a new surface element.
svg
Create a new SVG element.
tabs
Construct a controlled tabs primitive.
text_input
Construct an editable text field.
toggle
Construct a controlled toggle switch form control.
toolbar
Construct a semantic toolbar container.
transparent_black
Transparent black in Hsla
transparent_white
Transparent white in Hsla
tree
Construct a semantic tree container.
tree_item
Construct a semantic tree item primitive.
uniform_list
uniform_list provides lazy rendering for a set of items that are of uniform height. When rendered into a container with overflow-y: hidden and a fixed (or max) height, uniform_list will only render the visible subset of items.
webview
Creates a WebView element backed by the platform’s native embedded web content view.
white
Pure white in Hsla
write_crash_report
Write a crash report JSON file to the given directory.
yellow
The color yellow in Hsla

Type Aliases§

AlignSelf
Used to control how the specified nodes is aligned. Overrides the parent Node’s AlignItems property. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
ImageLoadingTask
An image loading task associated with an image cache.
ImgResourceLoader
A type alias to the resource loader that the img() element uses.
InspectorRenderer
Function set on App to render the inspector UI.
JustifyContent
Sets the distribution of space between and around content items For Flexbox it controls alignment in the main axis For Grid it controls alignment in the inline axis
JustifyItems
Used to control how child nodes are aligned. Does not apply to Flexbox, and will be ignored if specified on a flex container For Grid it controls alignment in the inline axis
JustifySelf
Used to control how the specified nodes is aligned. Overrides the parent Node’s JustifyItems property. Does not apply to Flexbox, and will be ignored if specified on a flex child For Grid it controls alignment in the inline axis
LottieResourceLoader
A type alias to the resource loader that the lottie() element uses.
Result
Result<T, Error>
Transform
Alias for euclid::default::Transform2D<f32>

Attribute Macros§

test
#[kael::test] can be used to annotate test functions that run with GPUI support.

Derive Macros§

Action
Action derive macro - see the trait documentation for details.
AppContext
#[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.
IntoElement
#[derive(IntoElement)] is used to create a Component out of anything that implements the RenderOnce trait.
Refineable
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.