# Smart buttons

*The buttons you need right now. Your agent changes them by time, place and what's next.*

**Type: [Act](types/act.md).** Where things stand, and the three things you'd want to do about it. This is one good use of it; the same widget serves a failing build, a production issue, a pull request, an email that needs you and more. Switch the subject when something else matters more.

Template id `smart-buttons` · Controls · uses Location, Calendar · for: Any agent; it needs a listener for buttons that ask it to do things.

## Goal

The user never hunts for the right app or shortcut. The action they need is already on the screen.

## When to offer it

The user keeps doing the same few things at certain times and places.

## What the user gets

- At work: join the next call, say you're late, start a timer
- At home at night: run your bedtime Shortcut, set tomorrow's alarm
- When you're out: head home, tell them you're on your way

## What each size shows

- **Small**: metric: Starts in = 8 min.
- **Medium**: metric: Starts in = 8 min; text (body): "Design review, room 4."; buttons: Join (`join`), I'm late (`late`), Notes (`notes`).
- **Large**: metric: Starts in = 8 min; text (body): "Design review, room 4."; buttons: Join (`join`), I'm late (`late`), Notes (`notes`); list: Why these (2 rows).
- **Lock Screen**: inline "Design review at 2:00".

## Make it theirs

**Look.** Send `look` instead of `theme` and `accent`; every combination is designed to read well:

- `style`: `glass` (default: see-through, adapts to dark mode), `soft` (a calm pale tint) or `bold` (a vivid gradient with dark buttons).
- `accent`: blue, indigo, purple, pink, red, orange, green, teal, graphite, or a hex.
- `font`: default, rounded, serif or mono.

This template's own accent is **blue**. To restyle a widget you already saved, send only the look:

```json
{"slug": "smart-buttons", "look": {"style": "bold", "accent": "blue", "font": "rounded"}}
```

Preview a look without saving: `droplet_preview_widget` with the slug and `look`. When the user says "make it greener", "calmer" or "bolder", change the look; keep the content.

**Their choices.** Ask once (droplet_ask) or use what you know:

- What they do at each place and time
- Their Shortcut names
- Who to tell when running late

**Search words:** buttons, controls, actions, shortcuts, dynamic, launcher, quick actions, join, control.


## Before you build

- Check `droplet_get_phone_context`: the phone must share location, calendar. If something is off, ask the user to turn it on in Droplet.ai, Settings, Phone access.
- You need: Any agent; it needs a listener for buttons that ask it to do things.
- Ask once: Before sending anything to someone for the first time.

## Fill it with real data

Start from the template (`droplet_library` with `id: "smart-buttons"`), keep the design, and replace each sample value:

| Block | Real value |
|---|---|
| 0 · metric | The time or number that explains the moment. |
| 1 · text | One short line on what's next. |
| 2 · buttons | Up to three actions. Those with a url run with no agent; the rest need your listener. |
| 3 · list | Why these buttons, right now. |

Sources:
- Next event and its join link (calendar).
- Current place and time, and what they do at each.
- Their Shortcuts, phone contacts or home scenes, if they tell you the names.

## The widget

Sample values; send it with `droplet_set_widget` on your widget's slug (or a new slug with `new_widget: true` if the user asked for a separate widget). Preview it and fix every warning first.

```json
{
  "slug": "smart-buttons",
  "title": "Next up",
  "symbol": "square.grid.2x2.fill",
  "accent": "#0A84FF",
  "blocks": [
    {"type": "metric", "label": "Starts in", "value": "8 min"},
    {"type": "text", "text": "Design review, room 4.", "style": "body"},
    {"type": "buttons", "items": [{"id": "join", "label": "Join", "symbol": "video.fill", "url": "https://meet.google.com/"}, {"id": "late", "label": "I'm late", "symbol": "clock.fill"}, {"id": "notes", "label": "Notes", "symbol": "doc.text.fill"}]},
    {"type": "list", "title": "Why these", "items": [{"title": "Your next meeting is close", "detail": "2:00"}, {"title": "6 people are waiting on it", "detail": ""}]}
  ],
  "variants": [{"when": {"place": "home", "from": "20:00", "to": "23:59"}, "title": "Tonight", "blocks": [{"type": "metric", "label": "Tomorrow", "value": "8:00"}, {"type": "text", "text": "Early start: board prep.", "style": "body"}, {"type": "buttons", "items": [{"id": "bedtime", "label": "Bedtime", "symbol": "moon.fill", "url": "shortcuts://run-shortcut?name=Bedtime"}, {"id": "alarm", "label": "Alarm 6:45", "symbol": "alarm.fill"}, {"id": "tomorrow", "label": "Tomorrow", "symbol": "calendar"}]}, {"type": "list", "title": "Why these", "items": [{"title": "You're home and it's late", "detail": ""}, {"title": "Tomorrow starts early", "detail": "8:00"}]}]}, {"when": {"place": "away"}, "title": "Out", "blocks": [{"type": "metric", "label": "From home", "value": "25 min"}, {"type": "text", "text": "Dinner at home at 7.", "style": "body"}, {"type": "buttons", "items": [{"id": "home", "label": "Go home", "symbol": "house.fill", "url": "https://maps.apple.com/?daddr=Home"}, {"id": "omw", "label": "On my way", "symbol": "paperplane.fill"}, {"id": "later", "label": "Running late", "symbol": "clock.fill"}]}, {"type": "list", "title": "Why these", "items": [{"title": "You're out", "detail": ""}, {"title": "Dinner's on your calendar", "detail": "7:00"}]}]}],
  "sizes": {"small": [0], "medium": [0, 1, 2], "large": [0, 1, 2, 3]},
  "lock": {"inline": "Design review at 2:00", "circular": 0}
}
```

## Keep it fresh

Write the versions each morning; the phone switches them. Update when the next event changes.

## Handle the taps

Each tap reaches you once on `droplet_get_events` (keep a waker running, SKILL.md Process C). Answer within seconds by updating the widget.

**Join** opens `https://meet.google.com/` directly; no event. Put the user's real link there.

**I'm late** (`late`)

```json
{"widget": "smart-buttons", "kind": "button", "target": "late", "value": {"label": "I'm late"}}
```

Tell the organiser, with their OK the first time, and show who you told.

**Notes** (`notes`)

```json
{"widget": "smart-buttons", "kind": "button", "target": "notes", "value": {"label": "Notes"}}
```

Fetch or prepare the notes, and put them on the widget.

## Ask first

Before sending anything to someone for the first time.

For example:

```json
{"question": "Tell Sam you're 10 minutes late?", "kind": "decision", "options": ["Tell Sam", "Don't"], "risk": "low"}
```

## Phone actions

Alarms, timers and reminders through droplet_phone_action. Buttons with a url open directly, with no agent running.

```json
{"kind": "alarm", "params": {"time": "06:45", "label": "Board prep at 8:00"}}
```

Send it with `droplet_phone_action` and tell the user what you set.

## Edge cases

- You have no listener running: only use buttons with a url or a phone action.
- A button no longer applies: remove it, and don't leave it there greyed out.

## Never

Never add a button you can't follow through on. No dead controls.

## Done when

- [ ] Every sample value is replaced with real data (no "Dr. Lee" on a real widget).
- [ ] `droplet_preview_widget` shows no warnings at the sizes the user placed (`placed` in `droplet_whoami`).
- [ ] Every button has a handler and a waker is running.
- [ ] Refresh is set up as above.
- [ ] You told the user in one line what it does on its own and what it asks first.

## Same widget, other uses

- [Meeting prep](meeting-prep.md): Before every meeting: who, why, and your notes ready.
- [Calendar clash](schedule-clash.md): Two things landed at the same time. Your agent found the fix; you tap it.
- [Worth your time](news-brief.md): One story that matters to your work, why it matters, and what to do about it.
- [Meeting controls](meeting-controls.md): Only around a meeting: join it, say you're late, then send the recap when it ends.
- [Home controls](home-scenes.md): At home, the controls for this moment: leaving, evening or bedtime.
- [Release room](release-room.md): A small app for one job: everything about a release, with the controls, built by your agent.
- [Needs a reply](inbox-zero.md): Your agent drafts the replies. You tap send.
- [Follow up](follow-up.md): Someone never replied. Your agent noticed and wrote the nudge.
- [Ship status](ship-status.md): Builds, failing tests and the fix, all one tap from your agent.
- [PR review](pr-review.md): Your agent read the pull request. You get the verdict and merge with a tap.
- [Production issue](incident.md): Something broke in production. Your agent already looked, and offers the fix.
