Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Signature Pad Dialog Block for React

A contract with a signing dialog shown open: a Draw tab with the catalog signature pad, a pen-width slider and Undo, Redo and Clear, a Type tab as the keyboard route, an honest line that it is not a legal e-signature, and the signature placed on the contract.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Collect a mark on a document without pretending it is more than that, with this signing dialog for React with Base UI. It opens from the Service agreement of Sealfold, a contract-signing tool: the page's header holds an outline Sign Button, and the contract, a title, clauses and a dashed box to sign in, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog has two Tabs. Draw holds the catalog Signature Pad on a dashed line, a pen-width Slider from 1 to 4 and Undo, Redo and Clear for the strokes. Type is the keyboard route: a name is set in an italic serif on the same line. Apply signature is the only Shine Button; it stays quiet until the open tab has something and says what it is waiting for, and the dialog says it is a drawn mark and not a legal e-signature, and that a typed name is not one either. Applied, the signature sits in the box on the contract, the strokes as an SVG path or the typed name as text, with "Signed in this demo". For preview the dialog is drawn open in place when the page loads; the header button opens the real Dialog.

FAQ

Why is the dialog already open, and what do I keep?

So you can see it without a click. On load the dialog is a copy drawn in place over the contract: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Sign button opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same SignFields component and share the block's state, so strokes drawn in the copy are in the real one. In your app keep the Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

How do the strokes, Undo, Redo and Clear work?

The pad keeps each stroke as an SVG path and the block holds them as a list, so they are controlled: Undo takes the last stroke off and keeps it, Redo puts it back, and drawing a new stroke drops what could have been redone. Clear empties the pad. The pen slider sets the width of the next strokes, 1 to 4, and does not change the ones already drawn. Each button is always on the page, quiet when it has nothing to do, and answers in words if you press it then.

How can someone sign without a pointer?

Through the Type tab, which is not an afterthought: the pad is pointer-only and says so in its name, and the dialog points to the tab beside the pad. A typed name is set in an italic serif on a dashed line, the same size as the pad, and Apply signature takes it. Typing is also the tab to use with a screen reader. The trigger is passed to DialogTrigger through render, and the dialog is controlled with open and onOpenChange.

What stays local in the demo, and how do I wire it up?

Everything. Apply signature puts the strokes or the name into the page's state and draws them in the box, with the fixed date 15 Oct 2026; nothing is signed, stored or sent. In your app read the strokes from onDraw (onDrawEnd also hands you an image through getDataUrl), send them from apply, and keep the SVG path as the picture of the mark.

How does it look on a phone?

The copy shown on load docks to the foot of the page as a bottom sheet with its buttons pinned and the content scrolling above them. The pad is full width and 160 px high, and the pen and strokes controls wrap onto two lines. The real dialog keeps the Dialog's own phone layout, a sheet stuck to the bottom of the screen.

  • Pro

    Terms Accept Dialog

    Confirm and consent

    A marketplace sign-up at its last step with the terms shown open: an alert dialog with six sections in a focusable scroll region, a reading bar, and a checkbox that stays off until the end has been reached.

  • Pro

    Profile Picture Dialog

    Account and security

    A profile page with its picture dialog shown open: a large preview over an Upload tab that checks one PNG, JPG or WebP up to 2 MB and shows it without cropping, and a Drawings tab of eight greyscale patterns, with Remove picture and Save picture.

  • Pro

    Confirm Action Dialog

    Confirm and consent

    A newsletter editor with its publish confirmation shown open: an alert dialog that lists what happens to the issue, a box that remembers the answer, and a foot that gives the question back.

  • Pro

    A profile page with its cover-crop dialog shown open: a drawn landscape in an image cropper with shape, zoom, turn and reset controls, and the same crop shown live as an avatar, a card thumbnail and a banner strip.

  • Pro

    Add Profile Dialog

    Account and security

    A newsletter's writers page with its byline composer shown open: a name, what they write, a 120 character bio, a mark from six drawn glyphs or initials and a switch, beside a card that shows the byline as it will print.

  • Pro

    Quick Note Dialog

    Notes and editing

    A sticky-note wall with its dialog shown open: a title, a note of up to 280 characters, an Idea, To-do, Reference or Later label, a reminder day on a calendar and a pin switch, and a new card that lands first on the wall.