Paper button
Layers of cut paper, or a pen sketch that boils.
<piix-paper-button>DOM + canvasForm-readyNew<piix-paper-button>Sign up</piix-paper-button>
Look
Size
The cut look stacks three sheets of grainy card with real gaps between them: hover lifts the top sheet and the shadows open up, pressing squashes them flat. The sketch look is a hand-drawn outline redrawn a few times a second, the way a cartoon line boils, with hatching that scribbles in on hover.
Installation
<!-- once, anywhere on the page: every component --> <script src="https://cdn.jsdelivr.net/npm/piixpal@0.6/piixpal.min.js"></script>
<!-- just paper button (the shared engine loads itself, once) --> <script src="https://cdn.jsdelivr.net/npm/piixpal@0.6/dist/c/paper-button.min.js"></script>
npm install piixpal // once, in your entry file import "piixpal";
// npm install piixpal
import "piixpal";
export default function Page() {
return (
<piix-paper-button>Sign up</piix-paper-button>
);
}
Usage
<piix-paper-button>Sign up</piix-paper-button>
Examples
Sketch
<piix-paper-button look="sketch">Read more</piix-paper-button> <piix-paper-button look="sketch" ink="#1f4d7a">Contact</piix-paper-button>
Colours
Three sheets, top first.
<piix-paper-button colors="#c9f2d9,#5fbf8f,#1f4d3a">Plant it</piix-paper-button> <piix-paper-button colors="#d8ecff,#6aa8e8,#1f3f73">Sail</piix-paper-button>
API reference
| Attribute | What it does | Default |
|---|---|---|
look | cut sketch | cut |
colors | three sheets, top first (cut) | #ffd8a8,#ff8a5c,#5a3d8a |
ink | line colour (sketch) | #1d1a2b |
size | sm md lg | md |
type | button submit reset | button |
href | makes it a link | – |
disabled | greyed out, can't be pressed | – |
Events
| Event | When |
|---|---|
click | like any button |
Accessibility
- A real, form-associated button.
- With reduced motion the sketch line stops boiling.