Code

Code is the small inline code-style wrapper.
Use it for command names, short snippets, key values, or other compact inline technical text that should stand out from prose. It is not a syntax highlighter and not a code editor surface.

Example

use fission::prelude::*;

let widget: Widget = Code {
    text: "fission run".into(),
}
.into();
This works well inside help panels, alerts, and setup instructions.

Field table

Field
Type
Meaning
Notes / default behavior
text
String
Inline code-like text to display.
Required.

What it is and what it is not

The checked-in Code widget is a styled text chip. It gives you a subtle background and compact padding, but it does not provide syntax coloring, line numbering, or an enforced monospace font family.
If you need editable source text, use TextInput or a dedicated editor surface. If you need multi-style or annotated code display, RichText gives you more control.

Specific advice

Keep Code short. Once the content becomes multi-line or structurally significant, a dedicated block layout is clearer than an inline chip.

Production checklist

For Code, review the fields that change behavior before treating the widget as finished: text. The goal is to make the product rule visible in state and actions, not hidden inside ad-hoc construction code.
If this widget appears inside an interactive flow, keep the surrounding action binding in the parent component and test that the flow still has one clear reducer path.
Check the semantics tree for the user-facing label or role that makes this widget understandable without relying only on pixels.
Add at least one component or harness test that confirms the visible text, semantic role, action dispatch, and layout constraint that matter for this widget in context.
If a screen starts repeating the same Code setup, extract a named component around this widget. That keeps the reference API small while making product code easier to read and safer for generated code to copy.
Kbd, Text, RichText, and Card.
Fission
A cross-platform, GPU-accelerated user interface framework for Rust. MIT licensed.
Copyright (c) 2026 Fission
Ready to use today. Widget APIs are expected to remain stable; some runtime and shell APIs may change before 1.0.0.
Fission 0.7.0