All skills
lassejlv avatar

/build-gpui-apps

@52f4cfd
by Lasselassejlv/skills50 stars
1

Build, scaffold, refactor, debug, review, and validate native Rust desktop applications with GPUI. Recommend GPUI Kit and ask before adopting it; use gpui_kit imports after agreement, or preserve the chosen upstream GPUI stack. Includes the merged GPUI Kit component and design skills, full application/Base/Component/Shell documentation, coding and design guides, state, actions, async, input, accessibility, motion, themes, native integration, packaging, auto updates, testing, and production delivery. Use paper-to-gpui when the primary task is faithfully translating a selected Paper.design frame into an existing view.

Use this Skill: https://skilld.dev/gh/lassejlv/skills/build-gpui-apps

This session only. Nothing lands on disk.

referencesgpui-kitupstreambaseprimitivesotp-input.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

OTP Input

A multi-cell one-time-code input driven by a shared text state.

Like every gpui-base primitive, OTP Input supplies behavior and semantic structure without imposing a product visual language. Apply GPUI styles and compose the exported parts to match your design system.

Example

The single native Cargo entrypoint selects this primitive from the shared showcase implementation. The same showcase is compiled once for the WASM preview above.

cargo run -p gpui-base-examples -- otp-input

Import

use gpui_kit::base::{OtpInput, OtpState};

Anatomy and API

The example composes OtpInput, OtpState. GPUI's standard styling and event traits provide presentation; these base types provide the interaction structure.

The authoritative module is components/otp_input.rs. Native and browser previews compile this same file.

State and events

OtpState owns the complete code and active cell; visual cells share that state.

Keep controlled state on the parent render type or in a GPUI entity. Update it in callbacks and call cx.notify(); do not recreate persistent entities during every render.

Complete Rust example

The complete implementation used by the runnable showcase is embedded directly from Rust source:

use gpui::{Context, IntoElement, ParentElement as _, Styled as _, div};
use gpui_base::OtpInput;

use super::super::BaseShowcase;

impl BaseShowcase {
    pub(in super::super) fn otp_input(&self, cx: &mut Context<Self>) -> impl IntoElement {
        let value: Vec<char> = self.otp.read(cx).value().chars().collect();
        let active = value.len().min(5);

        div()
            .w_56()
            .flex()
            .flex_col()
            .gap_1()
            .text_xs()
            .child(div().text_xs().child("Verification code"))
            .child(
                div().child(
                    OtpInput::new(&self.otp)
                        .flex()
                        .gap_1()
                        .children((0..6).map(|ix| {
                            div()
                                .size_7()
                                .flex()
                                .items_center()
                                .justify_center()
                                .border_1()
                                .border_color(if ix == active {
                                    super::example_rgb(0x171717)
                                } else {
                                    super::example_rgb(0xd4d4d4)
                                })
                                .child(value.get(ix).copied().unwrap_or(' ').to_string())
                        })),
                ),
            )
            .child(
                div()
                    .text_xs()
                    .text_color(super::example_rgb(0x737373))
                    .child("Enter the 6-digit code."),
            )
    }
}

The command above supplies application initialization, window creation, and shared BaseShowcase state.

Accessibility

Label the whole code, announce length/errors, and support paste.

Notes

Use stable element IDs where accepted. Verify focus, hover, active, selected, disabled, reduced-motion, and high-contrast appearances in the consuming design system.

Documentation license: original prose and illustrations for which GPUI Kit holds licensing rights are also offered under CC BY 4.0. When copying or adapting, credit GPUI Kit, link the source (https://gpui-kit.com/base/primitives/otp-input) and https://creativecommons.org/licenses/by/4.0/, and indicate changes. Code examples and software source use Apache-2.0; third-party material retains its terms; existing Apache-2.0 permissions remain.

Bundled from GPUI Kit. Documentation prose: CC BY 4.0; code examples: Apache-2.0. Changes: documentation links localized, asset URLs made absolute, and this attribution added.

Source: SKILL.md on GitHub

No alerts3d3 checks · Risk SAFE
  • Gen Agent Trust Hub3d

    The skill provides comprehensive documentation and reference material for building native desktop applications using Rust and GPUI. No security risks, prompt injections, or malicious behaviors were identified. External dependencies originate from reputable organizations in the Rust ecosystem.

  • Socket3d

    No alerts

  • Snyk3d

    Risk: LOW · No issues

Signed by skilld at 52f4cfd. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 days ago

README badge

README badge for lassejlv/skills/build-gpui-apps