Green bar enquiry
An email field and a green gradient send bar in a grey tray; sending slides a small toast up from the tray.
Part of the style
Rainbow Slot Ticker
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/rainbow-slot-ticker/toast-form/figma.html?palette=a00a69e670901cbb
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/rainbow-slot-ticker/toast-form/figma.html?palette=a00a69e670901cbb and pass that whole HTML document to the html_to_figma tool, so the part "Green bar enquiry" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<style>
/* Goes after the pack's base.css */
:root {
--ink: #c5c4c9;
--ink-soft: #676664;
--paper: #030303;
--tray: #080808;
--tray-line: #10100f;
--fade: rgba(3, 3, 3, 0.92);
--shade: rgba(197, 196, 201, 0.06);
--blue: #6a77c3;
--lime: #454b7a;
--green: #3d4276;
--lime-text: #b7bfe9;
--lime-light: #424557;
--lime-dark: #414775;
--lime-text-soft: #181b3e;
--red: #5460a9;
--orange: #414b93;
--amber: #454b7a;
--pink: #3f498f;
}
</style>
<section class="toast-form" aria-labelledby="toast-form-title" data-sent="Thanks. We will write back within two market days." data-empty="Add an email address so we can reply.">
<div class="toast-form__box">
<h2 class="toast-form__title" id="toast-form-title">Start a project</h2>
<p class="toast-form__lede">Tell us about your stall, shop or season. One line is enough.</p>
<form class="toast-form__tray" novalidate>
<label class="toast-form__field">
<span class="toast-form__label">Email</span>
<input class="toast-form__input" type="email" name="email" placeholder="you@yourshop.example" autocomplete="email" />
</label>
<label class="toast-form__field">
<span class="toast-form__label">What are you making?</span>
<textarea class="toast-form__input toast-form__area" name="note" rows="3" placeholder="A cider label, a winter menu, a whole new stall"></textarea>
</label>
<div class="toast-form__pick" role="group" aria-label="Budget">
<label class="toast-form__option"><input type="radio" name="size" value="s" checked /><span>Small</span></label>
<label class="toast-form__option"><input type="radio" name="size" value="m" /><span>Medium</span></label>
<label class="toast-form__option"><input type="radio" name="size" value="l" /><span>Large</span></label>
</div>
<button class="toast-form__send" type="submit">
<span class="toast-form__word">Send</span>
<span class="toast-form__hint">replies in 2 days</span>
</button>
</form>
</div>
<p class="toast-form__toast" role="status" aria-live="polite"></p>
</section>
<style>
.toast-form {
position: relative;
display: grid;
place-items: center;
padding: var(--space-xl) var(--edge) var(--section-space);
overflow: hidden;
}
.toast-form__box {
width: min(448px, 100%);
}
.toast-form__title {
margin: 0;
font-family: var(--font-serif);
font-size: var(--text-xl);
font-weight: 400;
line-height: 1.1;
}
.toast-form__lede {
margin: var(--space-s) 0 var(--space-l);
color: var(--ink-soft);
}
.toast-form__tray {
display: grid;
gap: var(--space-m);
padding: var(--space-m);
border-radius: var(--radius-l);
background: var(--tray);
}
.toast-form__field {
display: grid;
gap: var(--space-xs);
}
.toast-form__label {
color: var(--ink-soft);
font-size: var(--text-s);
}
.toast-form__input {
width: 100%;
min-height: var(--hit);
padding: 10px var(--space-m);
border: var(--rule) solid var(--tray-line);
border-radius: var(--radius-m);
background: var(--paper);
color: var(--ink);
font: inherit;
transition: border-color var(--quick) var(--ease);
}
.toast-form__area {
resize: vertical;
}
.toast-form__input::placeholder {
color: var(--ink-soft);
}
.toast-form__input:focus {
border-color: var(--blue);
outline: none;
}
.toast-form__input.is-wrong {
border-color: var(--red);
}
.toast-form__pick {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 6px;
}
.toast-form__option {
position: relative;
}
.toast-form__option input {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
margin: 0;
opacity: 0;
cursor: pointer;
}
.toast-form__option span {
display: grid;
place-items: center;
min-height: var(--hit);
border: var(--rule) solid var(--tray-line);
border-radius: var(--radius-m);
background: var(--paper);
cursor: pointer;
transition: color var(--quick) var(--ease), border-color var(--quick) var(--ease);
}
.toast-form__option:nth-child(1) { --word: var(--green); }
.toast-form__option:nth-child(2) { --word: var(--blue); }
.toast-form__option:nth-child(3) { --word: var(--pink); }
.toast-form__option span:hover {
color: var(--word);
}
.toast-form__option input:checked + span {
border-color: var(--word);
color: var(--word);
}
.toast-form__option input:focus-visible + span {
outline: 2px solid var(--blue);
outline-offset: 2px;
}
.toast-form__send {
display: flex;
justify-content: space-between;
align-items: center;
min-height: 52px;
padding: 0 var(--space-l) 0 var(--space-m);
border: var(--rule) solid var(--lime);
border-radius: var(--radius-m);
background: linear-gradient(var(--lime-light), var(--lime));
color: var(--lime-text);
font: inherit;
cursor: pointer;
transition: filter var(--quick) var(--ease), transform var(--quick) var(--ease), border-color var(--quick) var(--ease);
}
.toast-form__send:hover {
filter: saturate(1.25);
border-color: var(--lime-dark);
}
.toast-form__send:active {
transform: translateY(1px);
}
.toast-form__send:focus-visible {
outline: 2px solid var(--blue);
outline-offset: 2px;
}
.toast-form__word {
font-family: var(--font-serif);
font-size: var(--text-l);
line-height: 1.4;
}
.toast-form__hint {
color: var(--lime-text-soft);
}
.toast-form__toast {
position: absolute;
bottom: var(--space-l);
left: 50%;
max-width: calc(100% - 2 * var(--edge));
margin: 0;
padding: 10px var(--space-l);
border: var(--rule) solid var(--tray-line);
border-radius: var(--radius-l);
background: var(--paper);
box-shadow: 0 8px 24px var(--shade);
opacity: 0;
transform: translate(-50%, 140%);
transition: opacity var(--fade-time) var(--ease), transform var(--fade-time) var(--ease);
pointer-events: none;
}
.toast-form__toast.is-shown {
opacity: 1;
transform: translate(-50%, 0);
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.toast-form')) {
const form = root.querySelector('.toast-form__tray');
const email = root.querySelector('input[type="email"]');
const toast = root.querySelector('.toast-form__toast');
let timer = 0;
const say = (text) => {
toast.textContent = text;
toast.classList.add('is-shown');
clearTimeout(timer);
timer = setTimeout(() => toast.classList.remove('is-shown'), 2600);
};
email.addEventListener('input', () => email.classList.remove('is-wrong'));
form.addEventListener('submit', (event) => {
event.preventDefault();
if (!email.value.includes('@')) {
email.classList.add('is-wrong');
email.focus();
say(root.dataset.empty);
return;
}
form.reset();
say(root.dataset.sent);
});
}
})();
</script>