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

/display-glasses-with-jetpack-compose-glimmer

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

Provides guidelines for developing projected Android XR apps for display glasses using the Jetpack Compose Glimmer UI toolkit. Covers Glimmer design principles, workflows, and interaction models for the glasses form factor. Use this skill to build an Android XR Augmented Experience app with Jetpack Compose Glimmer. Don't use for audio-only AI glasses without a display, non-glasses Android XR headsets (spatial panels or 3D volumes with Jetpack Compose for XR), or phone and tablet Material 3 UIs.

Use this Skill: https://skilld.dev/gh/android/skills/display-glasses-with-jetpack-compose-glimmer

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

referencesiconbutton-source.md

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

When creating a Glimmer Icon component, refer to the following source code in IconButton.kt for icon buttons:

/*
 * Copyright 2026 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.xr.glimmer

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

/**
 * IconButton is a component used for exposing supplementary actions with a single tap.
 *
 * Icon buttons are used when a compact button is required, such as in a toolbar or image list.
 *
 * [content] should typically be an [Icon]. If using a custom icon, note that the typical size for
 * the internal icon is 32 x 32 dp. Container has an overall minimum size of 48 x 48 dp.
 *
 * @param onClick called when this icon button is clicked
 * @param modifier the [Modifier] to be applied to this icon button
 * @param enabled controls the enabled state of this icon button. When `false`, this icon button
 *   will not respond to user input
 * @param shape the [Shape] used to clip this icon button
 * @param color background color of this icon button
 * @param contentColor content color used by components inside [content]
 * @param contentPadding the spacing values to apply internally between the container and the
 *   content
 * @param interactionSource an optional hoisted [MutableInteractionSource] for observing and
 *   emitting Interactions for this icon button. You can use this to change the icon button's
 *   appearance or preview the icon button in different states. Note that if `null` is provided,
 *   interactions will still happen internally.
 * @param content the content of this icon button, typically an [Icon]
 * @sample androidx.xr.glimmer.samples.IconButtonSample
 */
@Composable
public fun IconButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shape: Shape = GlimmerTheme.shapes.large,
    color: Color = GlimmerTheme.colors.surface,
    contentColor: Color = calculateContentColor(color),
    contentPadding: PaddingValues = IconButtonDefaults.contentPadding,
    interactionSource: MutableInteractionSource? = null,
    content: @Composable () -> Unit,
) {
    val internalInteractionSource = interactionSource ?: remember { MutableInteractionSource() }

    Box(
        modifier
            .semantics { role = Role.Button }
            .surface(
                enabled = enabled,
                shape = shape,
                color = color,
                contentColor = contentColor,
                depthEffect = null,
                interactionSource = internalInteractionSource,
            )
            .clickable(
                enabled = enabled,
                interactionSource = internalInteractionSource,
                onClick = onClick,
            )
            .defaultMinSize(IconButtonDefaults.minimumSize)
            .padding(contentPadding),
        contentAlignment = Alignment.Center,
    ) {
        CompositionLocalProvider(
            LocalIconSize provides IconButtonDefaults.iconSize,
            content = content,
        )
    }
}

/** Default values used for [IconButton]. */
public object IconButtonDefaults {
    /** Default content padding for an [IconButton]. */
    @get:Composable
    public val contentPadding: PaddingValues
        get() = PaddingValues(GlimmerTheme.componentSpacingValues.small)

    /** Minimum size for icon-only buttons: [IconButton], [IconToggleButton]. */
    internal val minimumSize: Dp
        get() = 48.dp

    /** Default icon size for icon-only buttons: [IconButton], [IconToggleButton]. */
    @get:Composable
    internal val iconSize: Dp
        get() = GlimmerTheme.iconSizes.small
}
<br />

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.

No alerts6d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    The skill provides comprehensive guidelines and code samples for developing Android XR applications using the Jetpack Compose Glimmer UI toolkit. It follows standard Android development patterns and relies on official Android/XR libraries. No security risks were identified.

  • Socket6d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

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 33 minutes ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Google LLC",
  "last-updated": "2026-11-13",
  "keywords": [
    "Jetpack Compose Glimmer",
    "display glasses",
    "Projected Activity",
    "GlimmerTheme",
    "Additive Display",
    "Android XR - Augmented Experiences"
  ]
}

README badge

README badge for android/skills/display-glasses-with-jetpack-compose-glimmer