鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

gpui-layout-and-style

提供基于 Rust 类型安全的 CSS 风格布局能力,支持 Flexbox 排版、像素与相对单位尺寸控制、颜色边框阴影设置、响应式内外边距及条件化样式切换,适用于构建高一致性、可维护的桌面端 UI 组件。

软件开发
访问 GitHub
文档Skills.MD
name
gpui-layout-and-style
description
Layout and styling in GPUI. Use when styling components, layout systems, or CSS-like properties.

Overview

GPUI provides CSS-like styling with Rust type safety.

Key Concepts:

  • Flexbox layout system
  • Styled trait for chaining styles
  • Size units: px(), rems(), relative()
  • Colors, borders, shadows

Quick Start

Basic Styling

▼
rust
复制代码
use gpui::*; div() .w(px(200.)) .h(px(100.)) .bg(rgb(0x2196F3)) .text_color(rgb(0xFFFFFF)) .rounded(px(8.)) .p(px(16.)) .child("Styled content")

Flexbox Layout

▼
rust
复制代码
div() .flex() .flex_row() // or flex_col() for column .gap(px(8.)) .items_center() .justify_between() .children([ div().child("Item 1"), div().child("Item 2"), div().child("Item 3"), ])

Size Units

▼
rust
复制代码
div() .w(px(200.)) // Pixels .h(rems(10.)) // Relative to font size .w(relative(0.5)) // 50% of parent .min_w(px(100.)) .max_w(px(400.))

Common Patterns

Centered Content

▼
rust
复制代码
div() .flex() .items_center() .justify_center() .size_full() .child("Centered")

Card Layout

▼
rust
复制代码
div() .w(px(300.)) .bg(cx.theme().surface) .rounded(px(8.)) .shadow_md() .p(px(16.)) .gap(px(12.)) .flex() .flex_col() .child(heading()) .child(content())

Responsive Spacing

▼
rust
复制代码
div() .p(px(16.)) // Padding all sides .px(px(20.)) // Padding horizontal .py(px(12.)) // Padding vertical .pt(px(8.)) // Padding top .gap(px(8.)) // Gap between children

Styling Methods

Dimensions

▼
rust
复制代码
.w(px(200.)) // Width .h(px(100.)) // Height .size(px(200.)) // Width and height .min_w(px(100.)) // Min width .max_w(px(400.)) // Max width

Colors

▼
rust
复制代码
.bg(rgb(0x2196F3)) // Background .text_color(rgb(0xFFFFFF)) // Text color .border_color(rgb(0x000000)) // Border color

Borders

▼
rust
复制代码
.border(px(1.)) // Border width .rounded(px(8.)) // Border radius .rounded_t(px(8.)) // Top corners .border_color(rgb(0x000000))

Spacing

▼
rust
复制代码
.p(px(16.)) // Padding .m(px(8.)) // Margin .gap(px(8.)) // Gap between flex children

Flexbox

▼
rust
复制代码
.flex() // Enable flexbox .flex_row() // Row direction .flex_col() // Column direction .items_center() // Align items center .justify_between() // Space between items .flex_grow() // Grow to fill space

Theme Integration

▼
rust
复制代码
div() .bg(cx.theme().surface) .text_color(cx.theme().foreground) .border_color(cx.theme().border) .when(is_hovered, |el| { el.bg(cx.theme().hover) })

Conditional Styling

▼
rust
复制代码
div() .when(is_active, |el| { el.bg(cx.theme().primary) }) .when_some(optional_color, |el, color| { el.bg(color) })

Reference Documentation

  • Complete Guide: See reference.md
    • All styling methods
    • Layout strategies
    • Theming, responsive design
软件开发

快捷安装

复制到终端去安装 Skill

npxskillsaddlongbridge/gpui-component--skill"gpui-layout-and-style"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
debug
debug 是一个系统化定位软件缺陷根因的技能,适用于用户报告 'fix'、'broken'、'error' 等问题或测试意外失败时。它通过可验证的假设、最小复现、因果链分析和回归测试,确保在修复前准确定位根本原因。
retrieving-developer-knowledge
retrieving-developer-knowledge 用于搜索、获取和整合 Google 官方开发者文档,覆盖 Google Cloud、AI/Gemini、Android、Chrome、Web、Flutter、Go、Firebase 等平台,适用于查询 gcloud CLI 命令、API 语法、IAM 权限或架构对比等场景。
diff-intake
diff-intake 读取 PR 或分支差异,生成结构化 YAML 变更摘要,用于下游 analytics instrumentation 技能。适用于用户提交 PR 链接、分支对比或原始 diff 后需理解变更内容、评估分析覆盖或启动埋点流程的场景。
implement
实现 Linus Dashboard 的功能开发与集成,基于 TypeScript 和 Python 构建前后端组件,遵循严格的代码规范与架构模式,完成视图、卡片、服务及传感器等模块的创建与验证,确保高质量交付并兼容 Home Assistant 生态。
pypi-server
支持从源码构建 Python 软件包,并搭建本地 PyPI 服务,实现私有包的托管与分发,使团队可通过 pip 直接安装内部开发的模块。