Skip to main content

Crate fc_ui

Crate fc_ui 

Source
Expand description

§fc-ui: Professional UI Component Library for GPUI

A comprehensive, themeable component library inspired by shadcn/ui, designed specifically for building polished desktop applications using GPUI. Provides a complete set of reusable components with consistent styling, smooth animations, and progressively tested accessibility support.

§Architecture Overview

The library is organized into several key modules:

  • theme: Design tokens and theming system with light/dark variants
  • components: Core interactive elements (buttons, inputs, selects, etc.)
  • display: Presentation components (tables, cards, badges, etc.)
  • navigation: Navigation components (sidebars, menus, tabs, etc.)
  • overlays: Modal dialogs, popovers, tooltips, and command palettes
  • animations: Professional animation presets and easing functions

§Key Features

  • Theme System: Design tokens across 18 preset themes with light and dark variants; the active theme is installed explicitly via theme::install_theme (the library does not track the system appearance automatically)
  • Accessibility: Keyboard support across controls, with tested AccessKit semantics for Button, Checkbox, Select, Input, and Dialog
  • Performance: Optimized rendering with virtual scrolling for large datasets
  • Animation: Smooth, professional animations using spring physics and easing curves
  • Type Safety: Strong typing throughout with compile-time guarantees

§Design Philosophy

Components follow shadcn/ui principles with GPUI-specific optimizations:

  • Composition over inheritance for flexible component APIs
  • Builder pattern for ergonomic component construction
  • Entity-based state management for complex interactive components
  • Consistent naming and styling patterns across all components

§Usage Example

ⓘ
use fc_ui::{prelude::*, theme};

// Initialize theme and components
fn init_app(cx: &mut gpui::App) {
    theme::install_theme(cx, theme::Theme::dark());
    fc_ui::init(cx);
}

// Use components in your views
fn render(cx: &mut gpui::App) -> impl gpui::IntoElement {
    div()
        .child(Button::new("Click me").on_click(|_, _, _| println!("Clicked!")))
        .child(Input::new(&input_state).placeholder("Enter text..."))
}

Re-exports§

pub use icon_config::set_icon_base_path;
pub use http::init_http;
pub use http::init_http_with_user_agent;
pub use http::DEFAULT_USER_AGENT;
pub use http::try_init_http;
pub use http::try_init_http_with_user_agent;
pub use http::HttpInitError;
pub use http::HttpSetup;

Modules§

animate
animated_state
animation_coordinator
animations
charts
Compatibility facade for legacy chart paths.
components
Compatibility facade for the legacy component taxonomy.
content_transition
display
Compatibility facade for legacy display paths.
fonts
Font loading and registration
gestures
gpui_ext
http
HTTP client for remote image loading
icon_config
Icon configuration for custom asset paths
layout
navigation
Compatibility facade for legacy navigation paths.
overlays
Compatibility facade for legacy overlay paths.
prelude
Convenient re-exports for end users
responsive
scroll_physics
spring
styled_ext
theme
Compatibility facade for the canonical foundation theme.
transitions
util
Extension traits for common types
virtual_list

Enums§

InitError
Error returned by explicit root initialization.

Functions§

init
Initialize the UI library without changing GPUI’s HTTP client.
try_init_with
Initialize the UI library with an explicit HTTP-client policy.