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.

referencestitlechip-source.md

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

When creating a Glimmer Title Chip component, refer to the following source code in TitleChip.kt:

/*
 * Copyright 2025 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.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
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.unit.Dp
import androidx.compose.ui.unit.dp

/**
 * Title Chip is a component used to provide context for associated content, such as a [Card]. They
 * are designed for brief information, typically a short title, name, or status. Title chips are not
 * focusable, and not interactable.
 *
 * @sample androidx.xr.glimmer.samples.TitleChipSample
 *
 * Title chips may have a leading icon to provide more context:
 *
 * @sample androidx.xr.glimmer.samples.TitleChipWithLeadingIconSample
 *
 * To use a title chip with another component, place the title chip
 * [TitleChipDefaults.associatedContentSpacing] above the other component. For example, to use a
 * title chip with a card:
 *
 * @sample androidx.xr.glimmer.samples.TitleChipWithCardSample
 * @param modifier the [Modifier] to be applied to this title chip
 * @param leadingIcon optional leading icon to be placed before the [content]. This is typically an
 *   [Icon] tinted with [contentColor] by default.
 * @param shape the [Shape] used to clip this title chip, and also used to draw the background and
 *   border
 * @param color background color of this title chip
 * @param contentColor content color used by components inside [content] and [leadingIcon].
 * @param contentPadding the spacing values to apply internally between the container and the
 *   content
 * @param content the main content, typically [Text], to display inside this title chip
 */
@Composable
public fun TitleChip(
    modifier: Modifier = Modifier,
    leadingIcon: @Composable (() -> Unit)? = null,
    shape: Shape = GlimmerTheme.shapes.large,
    color: Color = GlimmerTheme.colors.surface,
    contentColor: Color = calculateContentColor(color),
    contentPadding: PaddingValues = TitleChipDefaults.contentPadding,
    content: @Composable RowScope.() -> Unit,
) {
    val iconSize = GlimmerTheme.iconSizes.small
    val horizontalInnerContentPadding = GlimmerTheme.componentSpacingValues.extraSmall

    CompositionLocalProvider(LocalTextStyle provides GlimmerTheme.typography.caption) {
        Row(
            modifier
                .surface(
                    shape = shape,
                    color = color,
                    contentColor = contentColor,
                    depthEffect = null,
                )
                .defaultMinSize(minHeight = MinimumHeight)
                .widthIn(max = MaximumWidth)
                .padding(contentPadding),
            horizontalArrangement = Arrangement.Center,
            verticalAlignment = Alignment.CenterVertically,
        ) {
            if (leadingIcon != null) {
                CompositionLocalProvider(LocalIconSize provides iconSize, content = leadingIcon)
            }
            Spacer(Modifier.width(horizontalInnerContentPadding))
            content()
            Spacer(Modifier.width(horizontalInnerContentPadding))
        }
    }
}

/** Default values used for [TitleChip]. */
public object TitleChipDefaults {
    /** Default content padding for a [TitleChip]. */
    public val contentPadding: PaddingValues
        @Composable get() = PaddingValues(GlimmerTheme.componentSpacingValues.extraSmall)

    /**
     * Default spacing between the bottom of a [TitleChip] and content associated with this title
     * chip, such as a [Card]. For example this can be used with a
     * [androidx.compose.foundation.layout.Spacer], or with [padding].
     *
     * @sample androidx.xr.glimmer.samples.TitleChipWithCardSample
     */
    public val associatedContentSpacing: Dp
        @Composable get() = GlimmerTheme.componentSpacingValues.medium
}

/** Default minimum height for a [TitleChip] */
private val MinimumHeight = 44.dp

/** Default maximum width for a [TitleChip] */
private val MaximumWidth = 352.dp
<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 34 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