Glass input
A glass text and search field over a drifting colour field; focus settles a halo of light around the box, the clear button arrives with the first keystroke, and error or success re-tint the rim.
Real scenarios
The component as it is used in a product — not a specimen grid.
Invite the team, find the pipes
Two glass fields over the same drifting colour field: focus settles a light halo around the box, the clear button arrives with the first keystroke, and the rim turns rose or green as the address proves itself.
Bring your team to Vitral
They land on the Frankfurt workspace, seats are billed monthly.
Looks deliverable — a magic link, no password to remember.
That address looks incomplete — the domain is missing a tail.
- Slack Connected
- Linear Connected
- Datadog Available
- GitHub Connected
- Figma Available
- Sentry Available
- Nothing matched — try “data” or “git”.
The four states, one skin
Idle, focused, error and success — the halo follows the state’s colour, and everything below sits on the same glass recipe.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| backdrop | blur · saturate | '16px · 1.4' | How much of the colour behind the glass gets blurred and saturated; less of it keeps the hues wetter. |
| halo | focus ring | '4px · accent 26%' | The halo of light around the focused box; its colour and width follow the state (rose for error, green for success). |
| state | idle · error · success | 'idle' | The box’s state; it moves with live address validation and brings the note beneath with it. |
| clearable | boolean | true | The clear button only slides in once there is a value; it carries its own aria-label. |
Snippet
<label class="gin-field" @error('email') data-state="error" @enderror>
<svg aria-hidden="true">…mail…</svg>
<input type="email" wire:model.live="email" placeholder="mia@northwind.dev">
<button type="button" wire:click="$set('email', '')" aria-label="Clear the address">
<svg>…x…</svg>
</button>
</label>
<style>
.gin-field { display: flex; align-items: center; gap: .55rem; inline-size: min(100%, 22rem);
padding: .85rem .95rem; border-radius: .9rem;
background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 10px 30px #00000022;
transition: border-color .2s ease, box-shadow .25s ease; }
.gin-field input { flex: 1; min-inline-size: 0; border: none; background: none;
outline: none; color: #10142e; }
.gin-field:focus-within { border-color: #aab4ff;
box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
0 0 0 4px #5a6cff42, 0 14px 34px #5a6cff3a; }
.gin-field[data-state='error'] { border-color: #ff9da0; }
</style>
// app/Pages/Invite.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import InviteForm from '@/components/InviteForm';
export default function Invite() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<InviteForm />
</main>
</NabuXUIProvider>
);
}
// InviteForm.jsx — glass input with focus halo, clear button and states
import { useState } from 'react';
import '@nabuxai/ui-core/css';
export default function InviteForm() {
const [email, setEmail] = useState('');
const ok = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email.trim());
const bad = email.trim().length > 3 && !ok;
const state = ok ? 'success' : bad ? 'error' : '';
return (
<>
<style>{`
.gin-stage { position: relative; overflow: clip; display: grid; place-items: center;
inline-size: min(100%, 26rem); padding: 3rem 1.25rem; border-radius: 1.25rem;
background: #eef0fb; }
.gin-stage::before, .gin-stage::after { content: ''; position: absolute; z-index: 0;
inline-size: 46%; aspect-ratio: 1; border-radius: 50%; filter: blur(30px) saturate(1.25); }
.gin-stage::before { inset-block-start: -14%; inset-inline-start: -8%; background: #5470ff; }
.gin-stage::after { inset-block-end: -20%; inset-inline-end: -10%; background: #9a6cff; }
.gin-field { position: relative; z-index: 1; display: flex; align-items: center; gap: .55rem;
inline-size: min(100%, 22rem); padding: .85rem .95rem; border-radius: .9rem;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 10px 30px #0003;
transition: border-color .2s ease, box-shadow .25s ease; }
.gin-field:focus-within { border-color: #aab4ff;
box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
0 0 0 4px #5a6cff42, 0 14px 34px #5a6cff3a; }
.gin-field[data-state='error'] { border-color: #ff9da0; }
.gin-field[data-state='success'] { border-color: #7ce3ac; }
.gin-field input { flex: 1; min-inline-size: 0; border: none; background: none;
outline: none; color: #10142e; font: 500 .95rem system-ui; }
.gin-clear { display: grid; place-items: center; inline-size: 1.6rem; aspect-ratio: 1;
border: 1px solid rgba(255,255,255,.44); border-radius: 50%;
background: rgba(255,255,255,.15); cursor: pointer; }
.gin-note { min-block-size: 1.2em; font-size: .78rem; }
.gin-note[data-tone='error'] { color: #e5484d; }
.gin-note[data-tone='success'] { color: #12a150; }
`}</style>
<div className="gin-stage">
<label className="gin-field" data-state={state}>
<svg aria-hidden="true" viewBox="0 0 24 24" width="18" height="18" fill="none"
stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="18" height="14" rx="2"
/><path d="m3 7 9 6 9-6" /></svg>
<input value={email} onChange={(e) => setEmail(e.target.value)}
type="email" placeholder="mia@northwind.dev" aria-label="Work email" />
{email && (
<button type="button" className="gin-clear" aria-label="Clear the address"
onClick={() => setEmail('')}>
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor"
stroke-width="2"><path d="M18 6 6 18M6 6l12 12" /></svg>
</button>
)}
</label>
<p className="gin-note" data-tone={bad ? 'error' : ok ? 'success' : undefined}>
{bad ? 'That address looks incomplete.' : ok ? 'A magic link, no password to remember.' : ''}
</p>
</div>
</>
);
}
<!-- InviteForm.vue — glass input with focus halo, clear button and states -->
<script setup lang="ts">
import { computed, ref } from 'vue';
import '@nabuxai/ui-core/css';
const email = ref('');
const ok = computed(() => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email.value.trim()));
const bad = computed(() => email.value.trim().length > 3 && !ok.value);
const state = computed(() => (ok.value ? 'success' : bad.value ? 'error' : ''));
</script>
<template>
<div class="gin-stage">
<label class="gin-field" :data-state="state">
<svg aria-hidden="true" viewBox="0 0 24 24" width="18" height="18" fill="none"
stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></svg>
<input v-model="email" type="email" placeholder="mia@northwind.dev" aria-label="Work email" />
<button v-if="email" type="button" class="gin-clear" aria-label="Clear the address"
@click="email = ''">
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor"
stroke-width="2"><path d="M18 6 6 18M6 6l12 12" /></svg>
</button>
</label>
<p class="gin-note" :data-tone="bad ? 'error' : ok ? 'success' : undefined">
{{ bad ? 'That address looks incomplete.' : ok ? 'A magic link, no password to remember.' : '' }}
</p>
</div>
</template>
<style scoped>
.gin-stage { position: relative; overflow: clip; display: grid; place-items: center; gap: .6rem;
inline-size: min(100%, 26rem); padding: 3rem 1.25rem; border-radius: 1.25rem; background: #eef0fb; }
.gin-stage::before, .gin-stage::after { content: ''; position: absolute; z-index: 0;
inline-size: 46%; aspect-ratio: 1; border-radius: 50%; filter: blur(30px) saturate(1.25); }
.gin-stage::before { inset-block-start: -14%; inset-inline-start: -8%; background: #5470ff; }
.gin-stage::after { inset-block-end: -20%; inset-inline-end: -10%; background: #9a6cff; }
.gin-field { position: relative; z-index: 1; display: flex; align-items: center; gap: .55rem;
inline-size: min(100%, 22rem); padding: .85rem .95rem; border-radius: .9rem;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 10px 30px #0003;
transition: border-color .2s ease, box-shadow .25s ease; }
.gin-field:focus-within { border-color: #aab4ff;
box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
0 0 0 4px #5a6cff42, 0 14px 34px #5a6cff3a; }
.gin-field[data-state='error'] { border-color: #ff9da0; }
.gin-field[data-state='success'] { border-color: #7ce3ac; }
.gin-field input { flex: 1; min-inline-size: 0; border: none; background: none;
outline: none; color: #10142e; font: 500 .95rem system-ui; }
.gin-clear { display: grid; place-items: center; inline-size: 1.6rem; aspect-ratio: 1;
border: 1px solid rgba(255,255,255,.44); border-radius: 50%;
background: rgba(255,255,255,.15); cursor: pointer; }
.gin-note { min-block-size: 1.2em; font-size: .78rem; }
.gin-note[data-tone='error'] { color: #e5484d; }
.gin-note[data-tone='success'] { color: #12a150; }
</style>
<!-- InviteForm.svelte — glass input with focus halo, clear button and states -->
<script lang="ts">
import '@nabuxai/ui-core/css';
let email = $state('');
const ok = $derived(/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email.trim()));
const bad = $derived(email.trim().length > 3 && !ok);
const state = $derived(ok ? 'success' : bad ? 'error' : '');
</script>
<div class="gin-stage">
<label class="gin-field" data-state={state}>
<svg aria-hidden="true" viewBox="0 0 24 24" width="18" height="18" fill="none"
stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></svg>
<input bind:value={email} type="email" placeholder="mia@northwind.dev" aria-label="Work email" />
{#if email}
<button type="button" class="gin-clear" aria-label="Clear the address"
onclick={() => (email = '')}>
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor"
stroke-width="2"><path d="M18 6 6 18M6 6l12 12" /></svg>
</button>
{/if}
</label>
<p class="gin-note" data-tone={bad ? 'error' : ok ? 'success' : undefined}>
{bad ? 'That address looks incomplete.' : ok ? 'A magic link, no password to remember.' : ''}
</p>
</div>
<style>
.gin-stage { position: relative; overflow: clip; display: grid; place-items: center; gap: .6rem;
inline-size: min(100%, 26rem); padding: 3rem 1.25rem; border-radius: 1.25rem; background: #eef0fb; }
.gin-stage::before, .gin-stage::after { content: ''; position: absolute; z-index: 0;
inline-size: 46%; aspect-ratio: 1; border-radius: 50%; filter: blur(30px) saturate(1.25); }
.gin-stage::before { inset-block-start: -14%; inset-inline-start: -8%; background: #5470ff; }
.gin-stage::after { inset-block-end: -20%; inset-inline-end: -10%; background: #9a6cff; }
.gin-field { position: relative; z-index: 1; display: flex; align-items: center; gap: .55rem;
inline-size: min(100%, 22rem); padding: .85rem .95rem; border-radius: .9rem;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 10px 30px #0003;
transition: border-color .2s ease, box-shadow .25s ease; }
.gin-field:focus-within { border-color: #aab4ff;
box-shadow: inset 0 1px 0 rgba(255,255,255,.5),
0 0 0 4px #5a6cff42, 0 14px 34px #5a6cff3a; }
.gin-field[data-state='error'] { border-color: #ff9da0; }
.gin-field[data-state='success'] { border-color: #7ce3ac; }
.gin-field input { flex: 1; min-inline-size: 0; border: none; background: none;
outline: none; color: #10142e; font: 500 .95rem system-ui; }
.gin-clear { display: grid; place-items: center; inline-size: 1.6rem; aspect-ratio: 1;
border: 1px solid rgba(255,255,255,.44); border-radius: 50%;
background: rgba(255,255,255,.15); cursor: pointer; }
.gin-note { min-block-size: 1.2em; font-size: .78rem; }
.gin-note[data-tone='error'] { color: #e5484d; }
.gin-note[data-tone='success'] { color: #12a150; }
</style>