This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
表面
用于样式化内容容器的 Jetpack Compose Surface 组件。
Android
Included in Expo Go
Recommended version:
~57.0.22
Expo UI Surface 与官方 Jetpack Compose Surface API 相匹配,并提供一个容器,应用 Material Design 表面样式,包括颜色、层次和内容颜色。
🌐 Expo UI Surface matches the official Jetpack Compose Surface API and provides a container that applies Material Design surface styling including color, elevation, and content color.
import{Host,Surface,Text}from'@expo/ui/jetpack-compose';import{ paddingAll }from'@expo/ui/jetpack-compose/modifiers';exportdefaultfunctionBasicSurfaceExample(){return(<HostmatchContents><Surface><Textmodifiers={[paddingAll(16)]}>
Content on a surface
</Text></Surface></Host>);}
有高程的表面
🌐 Surface with elevation
使用 tonalElevation 和 shadowElevation 来控制表面的视觉深度。
🌐 Use tonalElevation and shadowElevation to control the visual depth of the surface.
The color of the content inside the surface.
Defaults to contentColorFor(color).
enabled
Android
Optional • Type: boolean • Default: true
Whether the surface is enabled and responds to user interaction.
modifiers
Android
Optional • Type: ModifierConfig[]
Modifiers for the component.
onCheckedChange
Android
Optional • Type: (checked: boolean) => void
Called when the checked state of a toggleable surface changes.
Providing this callback together with checked enables the toggleable variant.
onClick
Android
Optional • Type: () => void
Called when the surface is clicked. Providing this callback makes the surface clickable.
When combined with selected, the surface becomes a selectable variant.
selected
Android
Optional • Type: boolean
Whether the surface is in a selected state. When provided together with onClick,
the surface becomes a selectable surface that visually reflects its selection state.