Interactions
How things respond to the pointer and to touch: cursors, whether text can be selected, whether clicks pass through, how touch gestures behave.
Examples
cursor-pointer
cursor-not-allowed
select-none (try to select me)
select-all: click once to pick all of me
<div class="box p-4 cursor-pointer">cursor-pointer</div>
<div class="box p-4 cursor-not-allowed opacity-50">cursor-not-allowed</div>
<div class="box p-4 select-none">select-none (try to select me)</div>
<div class="box p-4 select-all">select-all: click once to pick all of me</div>Clicks that pass through
pointer-events-none lets clicks go to whatever is underneath, for decorative layers over a picture or a fade at the edge of a list.
All classes
| Class | CSS |
|---|---|
pointer-events-none | pointer-events: none; |
pointer-events-auto | pointer-events: auto; |
select-none | user-select: none; -webkit-user-select: none; |
select-all | user-select: all; -webkit-user-select: all; |
select-auto | user-select: auto; -webkit-user-select: auto; |
cursor-auto | cursor: auto; |
cursor-default | cursor: default; |
cursor-pointer | cursor: pointer; |
cursor-text | cursor: text; |
cursor-move | cursor: move; |
cursor-grab | cursor: grab; |
cursor-grabbing | cursor: grabbing; |
cursor-not-allowed | cursor: not-allowed; |
cursor-wait | cursor: wait; |
cursor-help | cursor: help; |
cursor-zoom-in | cursor: zoom-in; |
touch-auto | touch-action: auto; |
touch-none | touch-action: none; |
touch-manipulation | touch-action: manipulation; |
touch-pan-x | touch-action: pan-x; |
touch-pan-y | touch-action: pan-y; |
resize-none | resize: none; |
resize-y | resize: vertical; |
resize-x | resize: horizontal; |
resize | resize: both; |
scroll-smooth | scroll-behavior: smooth; |
scroll-auto | scroll-behavior: auto; |
Good to know
- Use
cursor-pointeronly on things that do something; Momo buttons and links already have the right cursor. touch-pan-yon a horizontal carousel lets the page still scroll up and down with a finger.select-noneis for controls; never stop people from copying content they may need (addresses, codes, error messages).
Scroll snap and anchors
snap-x on a scrolling row and snap-start on its children make it stop neatly on each item. scroll-mt-navbar on a heading makes links to it land below a sticky navbar.
| Class | CSS |
|---|---|
snap-x | scroll-snap-type: x var(--u-snap, mandatory); |
snap-y | scroll-snap-type: y var(--u-snap, mandatory); |
snap-proximity | --u-snap: proximity; |
snap-none | scroll-snap-type: none; |
snap-start | scroll-snap-align: start; |
snap-center | scroll-snap-align: center; |
snap-end | scroll-snap-align: end; |
snap-always | scroll-snap-stop: always; |
scroll-mt-0 | scroll-margin-top: 0; |
scroll-mt-2 | scroll-margin-top: 0.5rem; |
scroll-mt-4 | scroll-margin-top: 1rem; |
scroll-mt-8 | scroll-margin-top: 2rem; |
scroll-mt-16 | scroll-margin-top: 4rem; |
scroll-mt-20 | scroll-margin-top: 5rem; |
scroll-mt-24 | scroll-margin-top: 6rem; |
scroll-mt-navbar | scroll-margin-top: calc(var(--momo-navbar-h, 0px) + 1rem); |
Form bits
Color the browser's own checkboxes, radios and range sliders with accent-brand or accent-<color>, and the text cursor with caret-*.
| Class | CSS |
|---|---|
accent-brand | accent-color: var(--momo-brand); |
accent-ink | accent-color: var(--momo-ink); |
caret-brand | caret-color: var(--momo-brand); |
caret-ink | caret-color: var(--momo-ink); |
caret-transparent | caret-color: transparent; |
appearance-none | appearance: none; -webkit-appearance: none; |