Index of every page on this site: llms.txt
All skills
android avatar

/adaptive

@7f7b217
by androidandroid/skills11k stars
703
Run it yourself

Instructions to make or update an app's UI so that it adapts to different Android devices including phones, tablets, foldables, laptops, desktop, TV, Auto, and XR. It includes how to handle different window sizes, pointing devices (such as mouse) and text entry devices (such as keyboard) using the Compose MediaQuery API, and how to preserve UI, navigation, scroll, and media playback state across configuration changes (such as folding/unfolding a foldable, rotating a device, or resizing a window). It also covers multi-pane layouts using Navigation3 Scenes, adaptive UI components (such as buttons) with varying target sizes, and adaptive layouts (including navigation areas - nav rails and nav bars) using the Compose Grid and FlexBox APIs. It also covers desktop experiences with keyboard shortcuts, tooltips and custom cursors.

Use this Skill: https://skilld.dev/gh/android/skills/adaptive

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestooltips.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Description

Use this document when you need to add or redesign tooltips in a Jetpack Compose application targeting Android large screens and desktop environments. Do not use Compose Multiplatform Desktop TooltipArea.

Expected output:

  • Brief analysis of targets and input methods, followed by an implementation that preserves accessibility, focus, and design-system rules.

Workflow

Step 1: Identify tooltip targets and text

Search the code and write down every candidate before implementing. Decide targets and wording yourself.

  1. Icon-only controls: IconButton, IconToggleButton, FloatingActionButton, TopAppBar navigationIcon and actions, toolbar and toolbox icons, a clickable Icon with a contentDescription, and navigation items (NavigationBarItem, NavigationRailItem, NavigationDrawerItem, navigationSuiteItems, Tab) whose label is hidden, like alwaysShowLabel = false or a collapsed rail.
  2. Unclear toolbar actions and controls with hidden keyboard shortcuts.
  3. Skip controls that are already clear from visible text. Never use a tooltip as the only source of a label, instruction, validation error, or disabled-state requirement.
  4. Check whether long-press already starts dragging, selection, or a context menu. Skip the tooltip if it conflicts.

For each tooltip, use a localized string and brief, sentence-case text:

  • Start from the control's accessibility label: for an icon-only control the Icon's contentDescription is normally the right tooltip text. Reuse the same string resource for both so they cannot drift, and keep the contentDescription on the icon --- a tooltip never replaces it.
  • Prefer verbs for actions: Add column, Export CSV, Mute track.
  • Keep plain tooltips short and clear.
  • Do not repeat visible button text unless the tooltip adds a shortcut or consequence.
  • Add shortcut hints only when accurate, e.g., Save (Ctrl+S).
  • For disabled controls, explain the requirement: Select a row first.

Step 2: Implement the tooltips

Iterate through the identified targets and implement tooltips for each according to the following patterns:

  • Reuse existing components: Use a shared wrapper for repeated tooltips and inline TooltipBox for one-off tooltips.

  • Tooltip type: Use PlainTooltip for a short label. Use RichTooltip for extra details or one action.

  • Tooltip trigger: Use the default hover-effect, long-press, and keyboard-focus behavior unless the tooltip should only be shown from code.

  • API: TooltipBox(positionProvider, tooltip = { PlainTooltip { Text(...) } }, state = rememberTooltipState()) { control }. Check the Material 3 version in the Gradle files first: on 1.4.0 or newer use TooltipDefaults.rememberTooltipPositionProvider(positioning = TooltipAnchorPosition.Above); on 1.3.x that function does not exist, use TooltipDefaults.rememberPlainTooltipPositionProvider().

Follow these rules:

  • Give each TooltipBox its own TooltipState.
  • Wrap exactly one control. Keep its click, focus, enabled state, and accessibility on the control, and keep the wrapper bounds tight.
  • For a rich tooltip with an action, use rememberTooltipState(isPersistent = true), set hasAction = true, and dismiss it after the action.
  • Before finishing, re-run the searches from Step 1: every match now has a tooltip or a stated reason to skip it. Do not stop at the first screen.
Show tooltips from code (optional)

Use this only for brief, nonessential help, such as feature education.

  • Call tooltipState.show() from a coroutine.
  • Call tooltipState.dismiss() directly when the tooltip is no longer needed.
  • Set enableUserInput = false if hover-effect, long-press, and keyboard focus should not show it.
  • Trigger show() from a user event or a one-time effect, not directly during composition.

Reference links

Consult these references before proceeding with the implementation.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warningtoday3 checks · Risk SAFE
  • Gen Agent Trust Hubtoday

    This skill provides instructions for developing adaptive Android UIs using Jetpack Compose and Navigation 3. It references official Google libraries and documentation, and uses standard development workflows. No security concerns were detected.

  • Socket7d

    No alerts

  • Snyktoday

    Risk: MEDIUM · 1 issue

Signed by skilld at 7f7b217. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 1 hour ago.

Activeupdated yesterday
Other metadata
metadata
{
  "author": "Google LLC",
  "last-updated": "2026-11-19",
  "keywords": [
    "android",
    "ui",
    "adaptive",
    "Grid",
    "FlexBox",
    "MediaQuery",
    "navigation",
    "foldables",
    "state",
    "resizability",
    "configuration-changes",
    "keyboard shortcuts",
    "tooltips",
    "custom cursors"
  ]
}

README badge

README badge for android/skills/adaptive