# JBNX buttons (v1.0.2)

One tactile button set for every JBNX site, LocalFave game (Spades, Tetris, Mahjong, DayZ) and FedM8 screen. Live page: https://jbnx.io/design/ux/buttons

## Files

- CSS (source of truth): https://jbnx.io/design/ux/buttons/buttons.css
- Tap feedback JS (optional): https://jbnx.io/design/ux/buttons/buttons.js
- Repos keep a copy at the same version (header says `v1.0.2`). Update the copy when the version here changes.

## Use

```html
<button class="jb-btn jb-btn--main">Play</button>
<button class="jb-btn jb-btn--second">Rules</button>
<button class="jb-btn jb-btn--danger">Quit</button>
<button class="jb-btn jb-btn--second jb-btn--icon" aria-label="Menu">☰</button>
```

| Class | Use |
| --- | --- |
| `jb-btn--main` | The one action that moves the user forward. One per view. |
| `jb-btn--second` | Every other action. |
| `jb-btn--danger` | Destructive or leaving: quit, delete, forfeit. |
| `jb-btn--sm` / `--lg` | Toolbars / hero calls. `--sm` still has a 44px tap target. |
| `jb-btn--icon` | Square icon button. Always add `aria-label`. |
| `jb-btn--block` | Full width (phone sheets, dialogs). |
| `.jb-dark` on a parent | Dark grounds (game tables, OS maps): switches the second-button colours. |

## Behaviour

- Depth: a solid bottom lip (`--jb-btn-depth`, 4px) plus a soft shadow.
- Hover (mouse only): lifts 1px and brightens.
- Press: sinks by its depth, lip disappears. Works on iOS with `buttons.js`, which also ticks the haptic.
- Haptics: apps with a vibration setting add `data-jb-haptics="off"` on `<html>` when it is off.
- Visibility: the set never decides whether a button shows. Your `display:none` rules and `hidden` always win.
- Focus: 3px ring on keyboard focus only.
- Disabled: `disabled` or `aria-disabled="true"`; greyed, half lip, no pointer.
- Tap target: never under 44x44px.
- Honours reduced motion and forced colours.

## Theme tokens

Set on `:root` or any parent. Keep the edge about 25% darker than the face.

`--jb-main` `--jb-main-fg` `--jb-main-edge` · `--jb-second` `--jb-second-fg` `--jb-second-edge` · `--jb-danger` `--jb-danger-fg` `--jb-danger-edge` · `--jb-btn-ring` `--jb-btn-radius` `--jb-btn-depth` `--jb-btn-h` `--jb-btn-font`

## Rules

- Never hand-roll a button. Use `jb-btn` plus one kind.
- Use `<button>` for actions and `<a class="jb-btn">` for navigation.
- One `--main` per view. Text is a verb: Play, Deal, Bid, Save.
- Do not restyle `.jb-btn` in an app; change tokens instead.
