# Screen

A full-screen container that pads for safe area insets and sets the status bar style.

Screen is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

Source: https://ui.suiss.app/docs/components/screen

**React Native, SwiftUI, Jetpack Compose**

![Preview](https://ui.suiss.app/previews/components-screen--default.light.webp)

```tsx
import { View } from "react-native"
import { Screen, ScreenContent } from "@/components/ui/screen"
import { Text } from "@/components/ui/text"

function Rows({ count = 4 }: { count?: number }) {
  return (
    <View className="overflow-hidden rounded-2xl bg-muted">
      {Array.from({ length: count }, (_, index) => `Row ${index + 1}`).map(
        (label, index) => (
          <View
            key={label}
            className={
              index > 0 ? "border-t border-border px-4 py-3" : "px-4 py-3"
            }
          >
            <Text>{label}</Text>
          </View>
        )
      )}
    </View>
  )
}

export function ScreenExample() {
  return (
    <Screen className="-m-4">
      <ScreenContent>
        <Text variant="h2">Account</Text>
        <Text variant="muted">
          The screen pads every safe-area edge and sets the status bar style
          from the color scheme.
        </Text>
        <Rows />
      </ScreenContent>
    </Screen>
  )
}
```

```swift
import EsuissUI
import SwiftUI

struct ScreenExample: View {
  var body: some View {
    Screen {
      ScreenContent(scroll: false) {
        Text("Account").textVariant(.h2)
        Text("The screen pads every safe-area edge and sets the status bar style from the color scheme.")
          .textVariant(.muted)
        ScreenRows()
      }
    }
  }
}

struct ScreenRows: View {
  var labels: [String] = (1...4).map { "Row \($0)" }
  var background: Color = EsuissColor.muted

  var body: some View {
    VStack(spacing: 0) {
      ForEach(Array(labels.enumerated()), id: \.offset) { index, label in
        Text(verbatim: label)
          .textVariant(.default)
          .frame(maxWidth: .infinity, alignment: .leading)
          .padding(.horizontal, 16)
          .padding(.vertical, 12)
          .overlay(alignment: .top) {
            if index > 0 {
              EsuissColor.border.frame(height: 1)
            }
          }
      }
    }
    .background(background)
    .clipShape(RoundedRectangle(cornerRadius: Radius.xl2, style: .continuous))
  }
}
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.esuiss.ui.components.Screen
import com.esuiss.ui.components.ScreenContent
import com.esuiss.ui.components.Separator
import com.esuiss.ui.components.Text
import com.esuiss.ui.components.TextVariant
import com.esuiss.ui.theme.EsuissTheme
import com.esuiss.ui.theme.Radius

@Composable
fun ScreenRows(labels: List<String>, background: Color) {
    Column(
        Modifier
            .fillMaxWidth()
            .clip(RoundedCornerShape(Radius.xl2))
            .background(background),
    ) {
        labels.forEachIndexed { index, label ->
            if (index > 0) Separator()
            Text(label, Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp))
        }
    }
}

fun screenRowLabels(count: Int): List<String> = (1..count).map { "Row $it" }

@Composable
fun ScreenDefault() {
    Screen {
        ScreenContent {
            Text("Account", variant = TextVariant.H2)
            Text(
                "The screen pads every safe-area edge and sets the status bar style from the color scheme.",
                variant = TextVariant.Muted,
            )
            ScreenRows(screenRowLabels(4), EsuissTheme.colors.muted)
        }
    }
}
```

`Screen` is a `View` that fills the screen, paints the `bg-background` color (or `bg-muted` for the `secondary` variant) and adds padding for the safe area insets on the edges you choose. It also renders a `StatusBar` with light or dark content to match the color scheme.

`ScreenContent` lays out the body with padding and gaps. With `scrollable`, it renders a `KeyboardScrollView` so content scrolls and stays above the keyboard.

## Installation

**React Native**

```bash title="Terminal"
npx shadcn@latest add @esuiss-rn/screen
```

See [Installation](https://ui.suiss.app/docs/installation) for the `components.json` setup. Or use the suiss/ui CLI:

```bash title="Terminal"
npx @esuiss/ui@latest add screen
```

**SwiftUI**

```bash title="Terminal"
npx @esuiss/ui@latest add screen --platform swift
```

**Jetpack Compose**

```bash title="Terminal"
npx @esuiss/ui@latest add screen --platform kotlin
```

The CLI also adds what it builds on: [Keyboard Scroll View](https://ui.suiss.app/docs/components/keyboard-scroll-view).

### Manual

**React Native**

**Uniwind**

1. Install the dependencies:

```bash title="Terminal"
npx expo install cn react-native-safe-area-context
```

2. Add the pieces it builds on: [Keyboard Scroll View](https://ui.suiss.app/docs/components/keyboard-scroll-view).

3. Copy the source into `components/ui/screen.tsx`:

```tsx title="uniwind/components/ui/screen.tsx"
import { cn } from "cn"
import * as React from "react"
import { StatusBar, useColorScheme, View, type ViewProps } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"

type ScreenEdge = "top" | "right" | "bottom" | "left"

const ALL_EDGES: readonly ScreenEdge[] = ["top", "right", "bottom", "left"]

const ScreenContext = React.createContext<{
  edges: readonly ScreenEdge[]
} | null>(null)

function Screen({
  edges = ALL_EDGES,
  variant = "default",
  className,
  style,
  children,
  ...props
}: ViewProps & {
  edges?: readonly ScreenEdge[]
  variant?: "default" | "secondary"
}) {
  const insets = useSafeAreaInsets()
  const scheme = useColorScheme()
  const context = React.useMemo(() => ({ edges }), [edges])
  return (
    <ScreenContext.Provider value={context}>
      <View
        className={cn(
          "flex-1",
          variant === "secondary" ? "bg-muted" : "bg-background",
          className
        )}
        style={[
          {
            paddingTop: edges.includes("top") ? insets.top : 0,
            paddingRight: edges.includes("right") ? insets.right : 0,
            paddingBottom: edges.includes("bottom") ? insets.bottom : 0,
            paddingLeft: edges.includes("left") ? insets.left : 0,
          },
          style,
        ]}
        {...props}
      >
        <StatusBar
          barStyle={scheme === "dark" ? "light-content" : "dark-content"}
        />
        {children}
      </View>
    </ScreenContext.Provider>
  )
}

function ScreenContent({
  scrollable = false,
  className,
  children,
  ...props
}: ViewProps & {
  scrollable?: boolean
}) {
  if (scrollable) {
    return (
      <KeyboardScrollView
        contentContainerClassName={cn("grow gap-4 p-4", className)}
        {...props}
      >
        {children}
      </KeyboardScrollView>
    )
  }
  return (
    <View className={cn("flex-1 gap-4 p-4", className)} {...props}>
      {children}
    </View>
  )
}

export type { ScreenEdge }
export { Screen, ScreenContent, ScreenContext }
```

4. Update the import paths to match your project.

**NativeWind**

1. Install the dependencies:

```bash title="Terminal"
npx expo install cn react-native-safe-area-context
```

2. Add the pieces it builds on: [Keyboard Scroll View](https://ui.suiss.app/docs/components/keyboard-scroll-view).

3. Copy the source into `components/ui/screen.tsx`:

```tsx title="nativewind/components/ui/screen.tsx"
import { cn } from "cn"
import * as React from "react"
import { StatusBar, useColorScheme, View, type ViewProps } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"

type ScreenEdge = "top" | "right" | "bottom" | "left"

const ALL_EDGES: readonly ScreenEdge[] = ["top", "right", "bottom", "left"]

const ScreenContext = React.createContext<{
  edges: readonly ScreenEdge[]
} | null>(null)

function Screen({
  edges = ALL_EDGES,
  variant = "default",
  className,
  style,
  children,
  ...props
}: ViewProps & {
  edges?: readonly ScreenEdge[]
  variant?: "default" | "secondary"
}) {
  const insets = useSafeAreaInsets()
  const scheme = useColorScheme()
  const context = React.useMemo(() => ({ edges }), [edges])
  return (
    <ScreenContext.Provider value={context}>
      <View
        className={cn(
          "flex-1",
          variant === "secondary" ? "bg-muted" : "bg-background",
          className
        )}
        style={[
          {
            paddingTop: edges.includes("top") ? insets.top : 0,
            paddingRight: edges.includes("right") ? insets.right : 0,
            paddingBottom: edges.includes("bottom") ? insets.bottom : 0,
            paddingLeft: edges.includes("left") ? insets.left : 0,
          },
          style,
        ]}
        {...props}
      >
        <StatusBar
          barStyle={scheme === "dark" ? "light-content" : "dark-content"}
        />
        {children}
      </View>
    </ScreenContext.Provider>
  )
}

function ScreenContent({
  scrollable = false,
  className,
  children,
  ...props
}: ViewProps & {
  scrollable?: boolean
}) {
  if (scrollable) {
    return (
      <KeyboardScrollView
        contentContainerClassName={cn("grow gap-4 p-4", className)}
        {...props}
      >
        {children}
      </KeyboardScrollView>
    )
  }
  return (
    <View className={cn("flex-1 gap-4 p-4", className)} {...props}>
      {children}
    </View>
  )
}

export type { ScreenEdge }
export { Screen, ScreenContent, ScreenContext }
```

4. Update the import paths to match your project.

**StyleSheet**

1. Install the dependencies:

```bash title="Terminal"
npx expo install react-native-safe-area-context
```

2. Add the pieces it builds on: [Keyboard Scroll View](https://ui.suiss.app/docs/components/keyboard-scroll-view).

3. Copy the source into `components/ui/screen.tsx`:

```tsx title="stylesheet/components/ui/screen.tsx"
import * as React from "react"
import { StatusBar, StyleSheet, View, type ViewProps } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { useTheme } from "@/components/ui/theme"

type ScreenEdge = "top" | "right" | "bottom" | "left"

const ALL_EDGES: readonly ScreenEdge[] = ["top", "right", "bottom", "left"]

const ScreenContext = React.createContext<{
  edges: readonly ScreenEdge[]
} | null>(null)

const styles = StyleSheet.create({
  root: { flex: 1 },
  content: { flex: 1, gap: 16, padding: 16 },
  scrollContent: { flexGrow: 1, gap: 16, padding: 16 },
})

function Screen({
  edges = ALL_EDGES,
  variant = "default",
  style,
  children,
  ...props
}: ViewProps & {
  edges?: readonly ScreenEdge[]
  variant?: "default" | "secondary"
}) {
  const { colors, isDark } = useTheme()
  const insets = useSafeAreaInsets()
  const context = React.useMemo(() => ({ edges }), [edges])
  return (
    <ScreenContext.Provider value={context}>
      <View
        style={[
          styles.root,
          {
            backgroundColor:
              variant === "secondary" ? colors.muted : colors.background,
            paddingTop: edges.includes("top") ? insets.top : 0,
            paddingRight: edges.includes("right") ? insets.right : 0,
            paddingBottom: edges.includes("bottom") ? insets.bottom : 0,
            paddingLeft: edges.includes("left") ? insets.left : 0,
          },
          style,
        ]}
        {...props}
      >
        <StatusBar barStyle={isDark ? "light-content" : "dark-content"} />
        {children}
      </View>
    </ScreenContext.Provider>
  )
}

function ScreenContent({
  scrollable = false,
  style,
  children,
  ...props
}: ViewProps & {
  scrollable?: boolean
}) {
  if (scrollable) {
    return (
      <KeyboardScrollView
        contentContainerStyle={[styles.scrollContent, style]}
        {...props}
      >
        {children}
      </KeyboardScrollView>
    )
  }
  return (
    <View style={[styles.content, style]} {...props}>
      {children}
    </View>
  )
}

export type { ScreenEdge }
export { Screen, ScreenContent, ScreenContext }
```

4. Update the import paths to match your project.

**SwiftUI**

1. Target iOS 17 or later.

2. Copy the theme files every view uses:

- `swift/Theme/Theme.swift`: [source](https://github.com/e-suiss/ui/blob/main/packages/mobile/swiftui/Sources/EsuissUI/Theme/Theme.swift)

- `swift/Theme/Tokens.swift`: [source](https://github.com/e-suiss/ui/blob/main/packages/mobile/swiftui/Sources/EsuissUI/Theme/Tokens.swift)

3. Copy the source and every file it uses:

```swift title="swift/Components/Screen.swift"
import SwiftUI

extension EnvironmentValues {
  @Entry var screenBackground: Color = EsuissColor.background
}

public struct Screen<Content: View>: View {
  public enum Background: CaseIterable, Sendable {
    case background, muted

    var color: Color {
      switch self {
      case .background: EsuissColor.background
      case .muted: EsuissColor.muted
      }
    }
  }

  let edges: Edge.Set
  let background: Background
  let content: Content

  public init(
    edges: Edge.Set = .all,
    background: Background = .background,
    @ViewBuilder content: () -> Content
  ) {
    self.edges = edges
    self.background = background
    self.content = content()
  }

  public var body: some View {
    VStack(spacing: 0) {
      content
    }
    .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
    .ignoresSafeArea(.container, edges: Edge.Set.all.subtracting(edges))
    .foregroundStyle(EsuissColor.foreground)
    .background(background.color.ignoresSafeArea())
    .environment(\.screenBackground, background.color)
  }
}

public struct ScreenContent<Content: View>: View {
  let scroll: Bool
  let padded: Bool
  let content: Content

  public init(scroll: Bool = true, padded: Bool = true, @ViewBuilder content: () -> Content) {
    self.scroll = scroll
    self.padded = padded
    self.content = content()
  }

  public var body: some View {
    if scroll {
      KeyboardScrollView {
        stack
      }
    } else {
      stack
        .frame(maxHeight: .infinity, alignment: .top)
    }
  }

  private var stack: some View {
    VStack(alignment: .leading, spacing: 16) {
      content
    }
    .padding(padded ? 16 : 0)
    .frame(maxWidth: .infinity, alignment: .leading)
  }
}
```

- `swift/Components/KeyboardScrollView.swift`: see [Keyboard Scroll View](https://ui.suiss.app/docs/components/keyboard-scroll-view.md)

4. Add the files to your app target.

**Jetpack Compose**

1. Set `minSdk` to 24 or higher and add the dependencies:

```kotlin title="build.gradle.kts"
implementation(platform("androidx.compose:compose-bom:2026.09.00"))
implementation("androidx.compose.foundation:foundation")
implementation("androidx.compose.ui:ui")
```

2. Copy the theme files every view uses:

- `kotlin/theme/Theme.kt`: [source](https://github.com/e-suiss/ui/blob/main/packages/mobile/kotlin/ui/src/main/kotlin/com/esuiss/ui/theme/Theme.kt)

- `kotlin/theme/Tokens.kt`: [source](https://github.com/e-suiss/ui/blob/main/packages/mobile/kotlin/ui/src/main/kotlin/com/esuiss/ui/theme/Tokens.kt)

3. Copy the source and every file it uses:

```kt title="kotlin/components/Screen.kt"
package com.esuiss.ui.components

import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.os.Build
import android.view.View
import android.view.Window
import android.view.WindowInsetsController
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsIgnoringVisibility
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.unit.dp
import com.esuiss.ui.theme.EsuissTheme
import com.esuiss.ui.theme.Typography

@Stable
internal class KeyboardAccessoryInset {
    var height by mutableIntStateOf(0)
}

internal val LocalKeyboardAccessory = staticCompositionLocalOf<KeyboardAccessoryInset?> { null }

enum class ScreenEdge { Top, Bottom, Left, Right }

enum class ScreenVariant { Default, Secondary }

private val AllScreenEdges = setOf(ScreenEdge.Top, ScreenEdge.Bottom, ScreenEdge.Left, ScreenEdge.Right)

private fun Set<ScreenEdge>.sides(): WindowInsetsSides? = map {
    when (it) {
        ScreenEdge.Top -> WindowInsetsSides.Top
        ScreenEdge.Bottom -> WindowInsetsSides.Bottom
        ScreenEdge.Left -> WindowInsetsSides.Left
        ScreenEdge.Right -> WindowInsetsSides.Right
    }
}.reduceOrNull { sides, side -> sides + side }

internal tailrec fun Context.findActivity(): Activity? = when (this) {
    is Activity -> this
    is ContextWrapper -> baseContext.findActivity()
    else -> null
}

@Suppress("DEPRECATION")
private fun Window.applyLightBars(light: Boolean) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
        val mask = WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS or WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
        insetsController?.setSystemBarsAppearance(if (light) mask else 0, mask)
        return
    }
    var flags = decorView.systemUiVisibility
    flags = if (light) flags or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR else flags and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        flags = if (light) flags or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR else flags and View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv()
    }
    if (decorView.systemUiVisibility != flags) decorView.systemUiVisibility = flags
}

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun Screen(
    modifier: Modifier = Modifier,
    edges: Set<ScreenEdge> = AllScreenEdges,
    variant: ScreenVariant = ScreenVariant.Default,
    content: @Composable BoxScope.() -> Unit,
) {
    val colors = EsuissTheme.colors
    val view = LocalView.current
    val light = !colors.isDark
    SideEffect {
        if (!view.isInEditMode) view.context.findActivity()?.window?.applyLightBars(light)
    }
    val sides = edges.sides()
    val accessory = remember { KeyboardAccessoryInset() }
    val fill = when (variant) {
        ScreenVariant.Default -> colors.background
        ScreenVariant.Secondary -> colors.muted
    }
    Box(
        modifier = modifier
            .fillMaxSize()
            .background(fill)
            .then(
                if (sides != null) {
                    Modifier.windowInsetsPadding(WindowInsets.systemBars.union(WindowInsets.displayCutout).union(WindowInsets.statusBarsIgnoringVisibility).only(sides))
                } else {
                    Modifier
                },
            ),
    ) {
        CompositionLocalProvider(
            LocalKeyboardAccessory provides accessory,
            LocalContentStyle provides Typography.base.copy(color = colors.foreground),
            LocalContentColor provides colors.foreground,
        ) {
            content()
        }
    }
}

@Composable
fun ScreenContent(
    modifier: Modifier = Modifier,
    scrollable: Boolean = false,
    contentPadding: PaddingValues = PaddingValues(16.dp),
    verticalArrangement: Arrangement.Vertical = Arrangement.spacedBy(16.dp),
    content: @Composable ColumnScope.() -> Unit,
) {
    Column(
        modifier = modifier
            .fillMaxWidth()
            .then(if (scrollable) Modifier.verticalScroll(rememberScrollState()) else Modifier)
            .padding(contentPadding),
        verticalArrangement = verticalArrangement,
        content = content,
    )
}
```

- `kotlin/components/Content.kt`: [source](https://github.com/e-suiss/ui/blob/main/packages/mobile/kotlin/ui/src/main/kotlin/com/esuiss/ui/components/Content.kt)

4. Update the `com.esuiss.ui` package names to match your project.

## Usage

```tsx
import { Screen, ScreenContent } from "@/components/ui/screen"
```

```tsx
<Screen className="-m-4">
  <ScreenContent>
    <Text variant="h2">Account</Text>
    <Text variant="muted">
      The screen pads every safe-area edge and sets the status bar style
      from the color scheme.
    </Text>
    <Rows />
  </ScreenContent>
</Screen>
```

Wrap each screen in `Screen` and put the body in `ScreenContent`. Use `variant="secondary"` for grouped screens such as settings.

Pass `edges` to pad only some sides, for example `["top"]` when a tab bar or bottom bar handles the bottom inset. Set `scrollable` on `ScreenContent` for content taller than the screen or for forms.

The app must be wrapped in a `SafeAreaProvider` from `react-native-safe-area-context`. `ScreenContext` exposes the active `edges` to children.

## Examples

### Secondary

A screen with the `secondary` background.

![Preview](https://ui.suiss.app/previews/components-screen--secondary.light.webp)

```tsx
import { View } from "react-native"
import { Screen, ScreenContent } from "@/components/ui/screen"
import { Text } from "@/components/ui/text"

export function ScreenSecondaryExample() {
  return (
    <Screen variant="secondary" className="-m-4">
      <ScreenContent>
        <Text variant="h2">Settings</Text>
        <View className="overflow-hidden rounded-2xl bg-background">
          {["General", "Privacy", "Notifications"].map((label, index) => (
            <View
              key={label}
              className={
                index > 0 ? "border-t border-border px-4 py-3" : "px-4 py-3"
              }
            >
              <Text>{label}</Text>
            </View>
          ))}
        </View>
      </ScreenContent>
    </Screen>
  )
}
```

```swift
import EsuissUI
import SwiftUI

struct ScreenSecondaryExample: View {
  var body: some View {
    Screen(background: .muted) {
      ScreenContent(scroll: false) {
        Text("Settings").textVariant(.h2)
        ScreenRows(labels: ["General", "Privacy", "Notifications"], background: EsuissColor.background)
      }
    }
  }
}

struct ScreenRows: View {
  var labels: [String] = (1...4).map { "Row \($0)" }
  var background: Color = EsuissColor.muted

  var body: some View {
    VStack(spacing: 0) {
      ForEach(Array(labels.enumerated()), id: \.offset) { index, label in
        Text(verbatim: label)
          .textVariant(.default)
          .frame(maxWidth: .infinity, alignment: .leading)
          .padding(.horizontal, 16)
          .padding(.vertical, 12)
          .overlay(alignment: .top) {
            if index > 0 {
              EsuissColor.border.frame(height: 1)
            }
          }
      }
    }
    .background(background)
    .clipShape(RoundedRectangle(cornerRadius: Radius.xl2, style: .continuous))
  }
}
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.esuiss.ui.components.Screen
import com.esuiss.ui.components.ScreenContent
import com.esuiss.ui.components.ScreenVariant
import com.esuiss.ui.components.Separator
import com.esuiss.ui.components.Text
import com.esuiss.ui.components.TextVariant
import com.esuiss.ui.theme.EsuissTheme
import com.esuiss.ui.theme.Radius

@Composable
fun ScreenRows(labels: List<String>, background: Color) {
    Column(
        Modifier
            .fillMaxWidth()
            .clip(RoundedCornerShape(Radius.xl2))
            .background(background),
    ) {
        labels.forEachIndexed { index, label ->
            if (index > 0) Separator()
            Text(label, Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp))
        }
    }
}

@Composable
fun ScreenSecondary() {
    Screen(variant = ScreenVariant.Secondary) {
        ScreenContent {
            Text("Settings", variant = TextVariant.H2)
            ScreenRows(listOf("General", "Privacy", "Notifications"), EsuissTheme.colors.background)
        }
    }
}
```

### Scrollable

A screen whose content scrolls.

![Preview](https://ui.suiss.app/previews/components-screen--scrollable.light.webp)

```tsx
import { View } from "react-native"
import { Screen, ScreenContent } from "@/components/ui/screen"
import { Text } from "@/components/ui/text"

function Rows({ count = 4 }: { count?: number }) {
  return (
    <View className="overflow-hidden rounded-2xl bg-muted">
      {Array.from({ length: count }, (_, index) => `Row ${index + 1}`).map(
        (label, index) => (
          <View
            key={label}
            className={
              index > 0 ? "border-t border-border px-4 py-3" : "px-4 py-3"
            }
          >
            <Text>{label}</Text>
          </View>
        )
      )}
    </View>
  )
}

export function ScreenScrollableExample() {
  return (
    <Screen className="-m-4">
      <ScreenContent scrollable>
        <Text variant="h2">Long content</Text>
        <Rows count={24} />
      </ScreenContent>
    </Screen>
  )
}
```

```swift
import EsuissUI
import SwiftUI

struct ScreenScrollableExample: View {
  var body: some View {
    Screen {
      ScreenContent {
        Text("Long content").textVariant(.h2)
        ScreenRows(labels: (1...24).map { "Row \($0)" })
      }
    }
  }
}

struct ScreenRows: View {
  var labels: [String] = (1...4).map { "Row \($0)" }
  var background: Color = EsuissColor.muted

  var body: some View {
    VStack(spacing: 0) {
      ForEach(Array(labels.enumerated()), id: \.offset) { index, label in
        Text(verbatim: label)
          .textVariant(.default)
          .frame(maxWidth: .infinity, alignment: .leading)
          .padding(.horizontal, 16)
          .padding(.vertical, 12)
          .overlay(alignment: .top) {
            if index > 0 {
              EsuissColor.border.frame(height: 1)
            }
          }
      }
    }
    .background(background)
    .clipShape(RoundedRectangle(cornerRadius: Radius.xl2, style: .continuous))
  }
}
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.esuiss.ui.components.Screen
import com.esuiss.ui.components.ScreenContent
import com.esuiss.ui.components.Separator
import com.esuiss.ui.components.Text
import com.esuiss.ui.components.TextVariant
import com.esuiss.ui.theme.EsuissTheme
import com.esuiss.ui.theme.Radius

@Composable
fun ScreenRows(labels: List<String>, background: Color) {
    Column(
        Modifier
            .fillMaxWidth()
            .clip(RoundedCornerShape(Radius.xl2))
            .background(background),
    ) {
        labels.forEachIndexed { index, label ->
            if (index > 0) Separator()
            Text(label, Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp))
        }
    }
}

fun screenRowLabels(count: Int): List<String> = (1..count).map { "Row $it" }

@Composable
fun ScreenScrollable() {
    Screen {
        ScreenContent(Modifier.fillMaxSize(), scrollable = true) {
            Text("Long content", variant = TextVariant.H2)
            ScreenRows(screenRowLabels(24), EsuissTheme.colors.muted)
        }
    }
}
```

### Top edge only

A screen that pads only the top inset.

![Preview](https://ui.suiss.app/previews/components-screen--top-edge-only.light.webp)

```tsx
import { Screen, ScreenContent } from "@/components/ui/screen"
import { Text } from "@/components/ui/text"

export function ScreenTopEdgeOnlyExample() {
  return (
    <Screen edges={["top"]} className="-m-4">
      <ScreenContent className="bg-muted">
        <Text variant="h3">Top edge only</Text>
        <Text variant="muted">
          The bottom, left and right edges are not padded.
        </Text>
      </ScreenContent>
    </Screen>
  )
}
```

```swift
import EsuissUI
import SwiftUI

struct ScreenTopEdgeOnlyExample: View {
  var body: some View {
    Screen(edges: .top) {
      ScreenContent(scroll: false) {
        Text("Top edge only").textVariant(.h3)
        Text("The bottom, left and right edges are not padded.")
          .textVariant(.muted)
      }
      .background(EsuissColor.muted)
    }
  }
}
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.esuiss.ui.components.Screen
import com.esuiss.ui.components.ScreenContent
import com.esuiss.ui.components.ScreenEdge
import com.esuiss.ui.components.Text
import com.esuiss.ui.components.TextVariant
import com.esuiss.ui.theme.EsuissTheme

@Composable
fun ScreenTopEdgeOnly() {
    Screen(edges = setOf(ScreenEdge.Top)) {
        ScreenContent(Modifier.background(EsuissTheme.colors.muted)) {
            Text("Top edge only", variant = TextVariant.H3)
            Text("The bottom, left and right edges are not padded.", variant = TextVariant.Muted)
        }
    }
}
```

### With bottom bar

A scrollable form with a bottom bar holding the main action.

![Preview](https://ui.suiss.app/previews/components-screen--with-bottom-bar.light.webp)

```tsx
import { BottomBar, BottomBarContent } from "@/components/ui/bottom-bar"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Screen, ScreenContent } from "@/components/ui/screen"
import { Text } from "@/components/ui/text"

export function ScreenWithBottomBarExample() {
  return (
    <Screen className="-m-4">
      <ScreenContent scrollable>
        <Text variant="h2">Your email</Text>
        <Text variant="muted">We will send a code to this address.</Text>
        <Input placeholder="name@example.com" keyboardType="email-address" />
      </ScreenContent>
      <BottomBar separator>
        <BottomBarContent>
          <Button size="lg" block>
            <Text>Continue</Text>
          </Button>
        </BottomBarContent>
      </BottomBar>
    </Screen>
  )
}
```

```swift
import EsuissUI
import SwiftUI

struct ScreenBottomBarDemo: View {
  @State private var email = ""

  var body: some View {
    Screen {
      ScreenContent {
        Text("Your email").textVariant(.h2)
        Text("We will send a code to this address.").textVariant(.muted)
        TextField(String("name@example.com"), text: $email)
          .textFieldStyle(.input)
          .keyboardType(.emailAddress)
          .textInputAutocapitalization(.never)
      }
      BottomBar(separator: true) {
        BottomBarContent {
          Button {} label: {
            Text("Continue")
          }
          .buttonStyle(.variant(size: .lg, block: true))
        }
      }
    }
  }
}
```

```kotlin
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.KeyboardType
import com.esuiss.ui.components.BottomBar
import com.esuiss.ui.components.BottomBarContent
import com.esuiss.ui.components.Button
import com.esuiss.ui.components.ButtonSize
import com.esuiss.ui.components.Input
import com.esuiss.ui.components.Screen
import com.esuiss.ui.components.ScreenContent
import com.esuiss.ui.components.Text
import com.esuiss.ui.components.TextVariant

@Composable
fun ScreenWithBottomBar() {
    var email by rememberSaveable { mutableStateOf("") }
    Screen {
        Column(Modifier.fillMaxSize()) {
            ScreenContent(Modifier.weight(1f), scrollable = true) {
                Text("Your email", variant = TextVariant.H2)
                Text("We will send a code to this address.", variant = TextVariant.Muted)
                Input(
                    email,
                    { email = it },
                    placeholder = "name@example.com",
                    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),
                )
            }
            BottomBar(separator = true) {
                BottomBarContent {
                    Button("Continue", onClick = {}, size = ButtonSize.Lg, block = true)
                }
            }
        }
    }
}
```

## API Reference

### Screen

The root view that pads for safe area insets.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `edges` | `readonly ScreenEdge[]` | `ALL_EDGES` | Which sides get safe area padding: any of `top`, `right`, `bottom`, `left`. Defaults to all four. |
| `variant` | `"default" \| "secondary"` | `"default"` | Background: `default` or `secondary`. |

Also accepts the props of `ViewProps`.

### ScreenContent

The padded body, optionally scrollable.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `scrollable` | `boolean` | `false` | Renders a `KeyboardScrollView` instead of a `View`. Defaults to `false`. |

Also accepts the props of `ViewProps`.

## Notes

- Uses the `bg-background` and `bg-muted` tokens.
- The status bar uses `light-content` in dark mode and `dark-content` in light mode, following the system appearance.
- Requires `react-native-safe-area-context` and the Keyboard Scroll View component.

