---
title: "Components, providers, and slots"
description: "A component declares its public inputs under props."
modificationDate: "2026-11-30"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Components, providers, and slots

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/learn/contract-for-humans/components-providers-and-slots: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

A component declares its public inputs under `props`. Every declared prop must be
supplied exactly once, with a compatible type; props have no defaults. An action prop passes behavior
without giving a child access to its parent's state.

```contract
component App
  state chosen = ""
  action choose(value: string)
    chosen = value
  view
    column gap=8
      Choice(title="One", select=choose)
      text chosen testId="chosen"

component Choice
  props
    title: string
    select: action
  view
    button press=select(title) testId="choice"
      text title
```

For values needed throughout a component tree, use a component `provide` section
and a descendant's typed `inject` section:

```contract
component App
  provide
    accent = "-exact-system-indigo"
  view
    Label(title="Hello")

component Label
  props
    title: string
  inject
    accent: string
  view
    text title color=accent
```

A bare provider entry, such as `accent`, provides the existing value of that
name. A provider covers the component's entire view. The nearest providing
component wins. An unsatisfied injection is a compile error. `provide name =
value` inside a view is obsolete; use the component section shown above.

A slot allows a component to wrap caller-authored children:

```contract
component App
  view
    Card()
      text "Inside the card"

component Card
  slot
  view
    column padding=16 border-radius=12 background-color="-exact-secondary-background"
      children
```

Declare `slot` on the receiving component and place `children` in its view.
The supplied children retain their caller's lexical scope and providers. This
is one slot, not named slots or an arbitrary render-function API.
