Skip to content
View Markdown

Using glass ​

Glass, drawn by Lumen behind controls and other content. It bends and tints whatever is underneath as the page moves.

tsx
import { Glass, GlassEffect, GlassEffectContainer, Button, LabeledContent } from '@satinhq/kit'

Example ​

Click Add Stop inside the glass effect.

Choose the material ​

Use Glass.regular or Glass.clear. The value supports .interactive() and .tintRGBA([r, g, b, a]) with normalized channels between 0 and 1.

Group effects ​

Put related GlassEffect views in a GlassEffectContainer. Give effects a glassEffectID and in={namespace} from useNamespace() when they need shared transition identity. id remains the DOM id.

glassEffectID requires a NamespaceID passed through in. Give related effects the same namespace and distinct identities. Retain each identity across renders; use the same identity at two alternate locations only when they represent the same effect. Omitting the namespace when supplying an identity is rejected. An effect without shared identity, like the example above, needs neither prop.

tsx
import { GlassEffect, GlassEffectContainer, Text, useNamespace } from '@satinhq/kit'

export function JourneyControls() {
  const namespace = useNamespace()
  return (
    <GlassEffectContainer>
      <GlassEffect glassEffectID="departure" in={namespace}>
        <Text padding>Departure</Text>
      </GlassEffect>
      <GlassEffect glassEffectID="arrival" in={namespace}>
        <Text padding>Arrival</Text>
      </GlassEffect>
    </GlassEffectContainer>
  )
}

Glass, matched geometry and navigation transitions use the same NamespaceID values returned by useNamespace or defineNamespace.

Provide readable pixels ​

Cross-origin frames, images without CORS and DRM video cannot supply pixels to glass. Read Known limitations before overlapping those sources.

API ​

Scroll horizontally to read every column.

PropTypeDescription
glassGlassRegular by default.
shapeGlassShapeCapsule by default.
glassEffectIDstringMorph identity, separate from DOM id.
glassEffectTransitionmatchedGeometry | identityglassEffectTransition
inNamespaceIDThe shared identity namespace.
glassEffectUnionstringAn optional union group.
spacingnumberGrouping spacing on the container.

Related: Quick start, List, Screen.

:::

Satin runs on the Lumen rendering engine and is open source under the MIT License.