Ask sheet modal with chips
A native dialog sheet with one question field, three suggested questions and a live area the answer is written into.
Links in the preview stay on the block.
Open on its ownThe prompt
One prompt, written to stand on its own: goal, structure, type, colour, spacing, behaviour and the words in square brackets to replace. Paste it into any tool that writes HTML. The Code tab has this block as one file.
746 words
# Ask sheet modal with chips One overlays component, not a whole page: build it to drop into a page that already exists. Works in Claude, v0, Lovable, Bolt, Cursor or any tool that writes HTML. ## Goal A modal sheet dropping from the top with one question field, a few suggested questions, and the answer written underneath. For an assistant inside a product. ## Structure 1. A dialog element pinned to the top, transparent, no padding. 2. An inner card, 1px border, 28px radius, 12px in from its edges. 3. A close button in the top end corner, 36px square. 4. A form, rows 10px apart, opening with the label: a 10px square rotated 45 degrees, then text tied to the input. 5. The field: a pill row, 1px border, a text input and a submit button. 6. Three chips, pill, 1px border, wrapping; an empty div for the answer, collapsed while empty. ## Type Onest 400, 17px/1.5, 16px under 760px, with IBM Plex Sans Arabic second in the stack. Label 14px, chips 14px, submit 600 15px, answer 17px/1.5, input 16px so phones do not zoom on focus. Both free on Google Fonts. ## Colour Card #FFFFFF, text #0B0C0F, label and secondary #5F646D, borders #E5E7EB moving to #0B0C0F when the field holds focus or a chip is hovered. The square mark and submit #2B3FF0 with #FFFFFF text. Close fills #F3F4F6 on hover. Backdrop #0B0C0F at 40 percent. AA: #5F646D on #FFFFFF, #FFFFFF on #2B3FF0. ## Spacing and lines Dialog min(760px, 100%) wide, max height 100dvh, top aligned. Card margin 12px, padding 22px 22px 20px, radius 28px at every width. Field padding 6px, 10px at its start edge, gap 8px, radius 999px; input padded 10px, submit 12px 22px. Chips 9px 15px, gaps 8px. Answer rows 12px apart. Close 36px square, 12px from the top and end edges. ## Behaviour Script needed. Open it with showModal, which gives the top layer, the backdrop, Escape and the focus trap, then focus the input about 30ms later. It closes on the close button, on Escape, and on a click whose target is the dialog itself, the backdrop; closing returns focus to whatever opened it. The card animates in once: opacity 0 to 1, translateY from minus 8px, .35s cubic-bezier(.2,.7,.1,1). A chip writes its text into the input and submits. Submit is prevented, the form marked busy, the answer written into the live area. Bind the / key when focus is not in a field. ## Responsive The sheet is 760px at most, full width below that, its 12px margins keeping it clear of both edges. Under 760px the page drops to 16px. ## Accessibility The dialog carries aria-label naming the assistant; aria-modal comes with showModal. The label is tied to the input with for and id; the placeholder is an example question. Chips are type button, submitted by the script. The answer area is aria-live polite, the close button aria-label Close with its sign aria-hidden. Focus ring 2px solid #2B3FF0, offset 3px. The close button is 36px square, so keep 44px of clear space around it. ## Built values (from code.html) - Fonts: IBM Plex Sans Arabic 400, 500, 600, 700 (Google Fonts); Onest 400 to 700 (Google Fonts). - Colour variables: --bg #fff, --ink #111, --muted #6b6b6b, --line #e4e4e4, --surface #f6f6f6, --accent #2b3ff0, --accent-ink #fff, --panel #F3F4F6, --pos #1F7A4D. - Font variables: --font-d system-ui, sans-serif; --font-u system-ui, sans-serif; --font-n ui-monospace, monospace. - Size variables: --r 14px, --bar-h 72px, --gutter clamp(16px, 4vw, 56px), --max 1320px. - Media queries: max-width 760px, prefers-reduced-motion. - No media files. - Script: none, CSS only. ## Content to replace - [Dialog label]: the assistant's name - [Prompt label]: who is asked - [Input placeholder]: a real question - [Submit label]: one word - [Chips]: three questions, under seven words - [Answer]: one paragraph and a link ## Rules Plain, specific copy that reads as a live product; never the word sample. No shadows, glow, glass, blur, gradient text, emoji or italics. Motion moves transform and opacity, with colour, border, height and stroke transitions on state changes, and holds its end state under prefers-reduced-motion. Text passes WCAG AA. ## Output Return the block in one piece: the markup, one style block with the web fonts imported on its first line, and a small script only if the behaviour needs one. No page wrapper, no framework, no build step. Prefix every class with `blk-` and put the colours and sizes in CSS variables at the top.
More like this
Overlays
Same page






