Skip to main content

Overview

The Ghostty Config editor is built with Svelte components organized into setting controls, UI elements, and specialized editors.

Setting Components

These components provide the UI for configuring individual settings.
Location: src/lib/components/settings/Color.svelteA color input component with an interactive color picker popout.

Props

PropTypeDefaultDescription
valueHexColor (bindable)-The current color value
sizenumber20Size of the color display in pixels
labelstring""Optional label to display on the color
defaultValueHexColor-Default value for reset functionality

Usage

<Color bind:value={config.background} defaultValue="#000000" size={40} />
Features:
  • Click to open ColorPicker modal
  • Right-click to reset to default value
  • Dynamic border color based on luminosity
  • Escape key closes the picker
Location: src/lib/components/ColorPicker.svelteInteractive HSV color picker with hex/RGB display.

Props

PropTypeDefaultDescription
valueHexColor | "" (bindable)-The current color value
defaultValueHexColor"#408080"Default color when value is empty

Implementation Details

// Color space state management
let {hue, saturation, value: brightness} = $state(rgbToHsv(...hexToRgb(value || defaultValue)));
const [red, green, blue] = $derived.by(() => hsvToRgb(hue, saturation, brightness));
Features:
  • 2D saturation/brightness gradient selector
  • Horizontal hue slider
  • Live hex input with validation
  • RGB value display
  • Empty state visualization (red X)
Location: src/lib/components/settings/Palette.svelteGrid display for terminal color palette (256 colors).

Props

PropTypeDescription
valueHexColor[] (bindable)Array of 256 palette colors
defaultValueHexColor[]Default palette for reset

Usage

<Palette bind:value={config.palette} defaultValue={defaults.palette} />
Displays an 8×32 grid where each color shows its index (1-256).
Location: src/lib/components/settings/KeybindEditor.svelteAdvanced keybind configuration interface.

Props

PropTypeDescription
valuestringThe keybind string to edit
onsave(value: string) => voidCallback when user saves
oncancel() => voidCallback when user cancels

Keybind Structure

type Step = {
  key: string;
  modifiers: string[];  // shift, ctrl, alt, super
};
Features:
  • Prefix selection (global, all, unconsumed, performable)
  • Multi-step sequence editor (up to 4 steps)
  • Action dropdown with argument validation
  • Special handling for resize_split action
  • Live preview with error validation
  • Key name autocomplete from 177+ valid keys

Example Output

ctrl+shift+t=new_tab
global:ctrl+q=quit
ctrl+k>ctrl+v=new_split:down
Location: src/lib/components/settings/Number.svelteNumeric input with optional range slider.

Props

PropTypeDescription
valuenumber (bindable)The numeric value
minnumberMinimum value
maxnumberMaximum value
stepnumberStep increment
rangebooleanShow as range slider
placeholderstringPlaceholder text

Usage

<Number bind:value={fontSize} min={6} max={72} step={1} />
<Number bind:value={opacity} min={0} max={1} step={0.1} range />
Location: src/lib/components/settings/Text.svelteText input for string settings.

Props

PropTypeDefaultDescription
valuestring (bindable)-Text value
placeholderstring""Placeholder text
blankbooleanfalseTransparent background
align"left" | "right""right"Text alignment
change(e: Event) => void-Change handler
Location: src/lib/components/settings/Switch.svelteAnimated toggle switch for boolean values.

Props

PropTypeDefaultDescription
checkedboolean (bindable)falseSwitch state
disabledbooleanfalseDisable interaction
onchange(checked: boolean) => void-Change callback

Styling

Uses CSS custom properties:
  • --switch-body-color
  • --switch-checked-color
  • --switch-active-body-color
  • --switch-active-checked-color
Location: src/lib/components/settings/Checkbox.svelteCheckbox with animated checkmark.

Props

PropTypeDefaultDescription
checkedboolean (bindable)falseChecked state
disabledbooleanfalseDisable interaction
onchange(checked: boolean) => void-Change callback
Features:
  • SVG checkmark with stroke-dasharray animation
  • Blue gradient when checked
  • Grayscale when disabled

Layout Components

Location: src/lib/components/settings/Group.svelteContainer for related settings with optional title.

Props

PropTypeDefaultDescription
titlestring""Group heading
notestring""Subtitle description
flexstring | number""CSS flex value
borderlessbooleanfalseRemove background/border
childrenSnippet-Content slot

Usage

<Group title="Appearance" note="Visual customization options">
  <Item name="Font Size">
    <Number bind:value={fontSize} />
  </Item>
</Group>
Location: src/lib/components/settings/Item.svelteIndividual setting row with label and control.

Props

PropTypeDescription
namestringSetting label
notestringHelp text below the control
childrenSnippetThe setting control component

Layout

<div class="setting-item">
  <div class="row">
    <div class="setting-name">{name}</div>
    <div class="setting">{@render children()}</div>
  </div>
  {#if note}<div class="note">{note}</div>{/if}
</div>

Specialized Components

Location: src/lib/components/settings/Theme.svelteSpecial dropdown that loads color schemes.

Props

PropTypeDescription
valuestring (bindable)Theme name
optionsArray<string | {name: string, value: string}>Available themes

Implementation

async function change() {
  await setColorScheme(value);
}
When changed, fetches the theme file and updates all color settings (background, foreground, palette, etc.).

UI Components

General-purpose UI components used throughout the application.
Location: src/lib/components/Admonition.svelteCallout box for important information or warnings.

Props

PropTypeDescription
childrenSnippetAdmonition content

Usage

<Admonition>
  This tool will have bugs! Please report them on GitHub.
</Admonition>
Displays content in a highlighted box with visual styling to draw attention.
Location: src/lib/components/Tab.svelteTab button component for tabbed interfaces.

Props

PropTypeDescription
selectedbooleanWhether this tab is active
onclick() => voidClick handler
childrenSnippetTab label content

Features

  • Visual active/inactive states
  • Keyboard accessible
  • Smooth transitions
Location: src/lib/components/Tooltip.svelteTooltip component with positioning logic.

Props

PropTypeDescription
textstringTooltip content
childrenSnippetElement to attach tooltip to

Features

  • Hover-triggered display
  • Auto-positioning to avoid viewport edges
  • Uses tooltip action from src/lib/attachments/tooltip.ts
Location: src/lib/components/History.svelteNavigation history controls (back/forward buttons).

Features

  • Browser-style navigation
  • Integrates with history store
  • Disabled state when can’t navigate
  • Keyboard shortcuts support

Implementation

import {canGoBack, canGoForward, processNavigation} from "$lib/stores/history.svelte";
Location: src/lib/components/User.svelteUser profile display component.

Props

PropTypeDescription
namestringUser name
avatarstringAvatar image URL
subtextstringOptional subtitle

Usage

Used on the home page to display the project author information.
Location: src/lib/components/Gap.svelteSpacer component for layout.

Props

PropTypeDefaultDescription
sizenumber10Gap size in pixels

Usage

<Gap size={20} />
Creates vertical spacing between elements.

Preview Components

These components from src/lib/views/ provide live previews of configuration changes.
Location: src/lib/views/CursorPreview.svelteAnimated cursor preview showing the current cursor style and color.

Features

  • Displays animated cursor based on config.cursorStyle
  • Shows cursor color from config.cursorColor
  • Supports all cursor styles: block, bar, underline
  • Includes blinking animation
  • Displays sample text for context

Usage

Referenced in the Features documentation and visible in the Colors settings panel.
Location: src/lib/views/FontPreview.svelteInteractive font testing playground with sample terminal output.

Features

  • Live font family preview
  • Font size adjustment
  • Bold and italic style toggles
  • Sample text with code, Unicode, and box-drawing characters
  • Does not persist changes (for testing only)

Sample Content

$ echo "Testing fonts"
┌─────────────────┐
│ Hello, World! → │
└─────────────────┘
Location: src/lib/views/PalettePreview.svelteGrid visualization of the 256-color terminal palette.

Features

  • 8×32 color grid layout
  • Displays all 256 palette colors
  • Each cell shows its index number
  • Updates in real-time as palette is modified
  • Clickable cells to edit individual colors
Location: src/lib/views/BaseColorPreview.sveltePreview component for base terminal colors.

Features

  • Shows background, foreground, and selection colors
  • Displays sample selected text
  • Updates reactively with color changes
  • Demonstrates actual text rendering
Location: src/lib/views/AppIconPreview.sveltemacOS app icon customization preview (macOS-specific feature).

Props

PropTypeDescription
configConfigConfiguration object with icon settings

Features

  • Previews custom app icons with different styles
  • Shows icon ghost color effects
  • Displays icon frame styles
  • macOS-only functionality
  • Real-time preview of icon appearance

Supported Icon Styles

  • Default Ghostty icon
  • Custom icon frames (floating, decorative, etc.)
  • Ghost color overlays
Location: src/lib/views/Page.svelteLayout wrapper component for all pages.

Props

PropTypeDescription
titlestringPage title for browser tab
childrenSnippetPage content

Features

  • Sets document title
  • Provides consistent page layout
  • Handles navigation integration

Component Patterns

Bindable Props

All setting components use Svelte 5’s $bindable() rune:
let {value = $bindable(), options}: Props = $props();

Derived State

Many components use $derived for reactive computations:
const borderColor = $derived(`rgba(255, 255, 255, ${luminosity(value) * 0.0027451 + 0.3})`);

Snippets

Layout components accept children via snippets:
import type {Snippet} from "svelte";

const {children}: {children: Snippet} = $props();

{@render children()}

Build docs developers (and LLMs) love