> ## Documentation Index
> Fetch the complete documentation index at: https://anvil.servicetitan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Peek

> Reference implementations for peek popover lockups.

Peek blocks compose `Popover` with Anvil2 layout and content components to preview an entity's key details on hover. Each example below is a starting point: copy it, then adapt the content and dimensions to your data. For guidance on when a peek is the right pattern, see the Peek pattern.

## Resources

> [card] [Peek pattern](https://anvil.servicetitan.com/docs/patterns/peek/web.md)
>
> When to use peeks and related guidance.

> [card] [Peek](https://www.figma.com/design/9OB8FwOZZc079PBR6XY8vP/Anvil-Blocks?m=auto\&node-id=389-18046\&t=nNee5IYZzpAe2ufo-1)
>
> Figma reference implementations for peek popover lockups.

## Demo

Demonstrates the core peek behavior: a `Popover` that opens on hover to preview a customer's identity, status, and balance. Use this as the starting point for most peeks.

peek-demo

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-demo?file=src/App.tsx)

```tsx lines theme={null}
import { Popover, Flex, Text, Chip, Avatar, Grid } from "@servicetitan/anvil2";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover
        openOnHover
        placement="top-start"
        disableShift
        disableFlip
        defaultOpen
      >
        <Popover.Button>Hover to see peek behavior</Popover.Button>
        <Popover.Content style={{ maxWidth: "360px" }}>
          <Flex direction="column" gap="4">
            <Flex gap="2">
              <Text variant="headline" size="small" el="h4">
                Customer
              </Text>
              <Chip label="Commercial" size="small" />
            </Flex>
            <Flex gap="3">
              <Avatar name="Dog01" size="large" />
              <Flex direction="column">
                <Text>
                  <b>Costco Wholesale Corporation</b>
                </Text>
                <Text subdued size="small">
                  123 Main Street Glendale CA 12345
                </Text>
              </Flex>
            </Flex>
            <Flex direction="column" gap="1">
              <Text variant="eyebrow" size="small">
                Tags
              </Text>
              <Flex wrap="wrap" gap="1">
                <Chip
                  label="FSD Installed 5 Yrs Ago"
                  size="small"
                  color="#5A8CEF"
                />
                <Chip label="HVAC" size="small" color="#6100FF" />
                <Chip label="Quickbase" size="small" color="#769A8A" />
                <Chip
                  label="Commercial SA Member"
                  size="small"
                  color="#FF9900"
                />
              </Flex>
            </Flex>
            <Grid templateColumns="repeat(2, 1fr)">
              <Flex direction="column">
                <Text variant="eyebrow" size="small">
                  Balance due
                </Text>
                <Text size="small">$1,503.00</Text>
              </Flex>
              <Flex direction="column">
                <Text variant="eyebrow" size="small">
                  Credit
                </Text>
                <Text size="small">$0.00</Text>
              </Flex>
            </Grid>
          </Flex>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Usage

Pairs an `Avatar` with a name and a supporting line. Use for a minimal identity peek when only the entity's name and status matter.

peek-usage

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-usage?file=src/App.tsx)

```tsx lines theme={null}
import { Popover, Flex, Text, Avatar } from "@servicetitan/anvil2";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Jane Doe</Popover.Button>
        <Popover.Content>
          <Flex gap="3" justifyContent="center">
            <Avatar name="Dog01" size="large" />
            <Flex direction="column">
              <Text>
                <b>Jane Doe</b>
              </Text>
              <Text subdued size="small">
                Customer since 2018
              </Text>
            </Flex>
          </Flex>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Activity Feed

Stacks recent events in `Card` rows beneath a header with quick actions. Use to surface an entity's latest activity, such as mentions, updates, and reminders.

peek-activity-feed

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-activity-feed?file=src/App.tsx)

```tsx lines theme={null}
import {
  Popover,
  Flex,
  Text,
  Button,
  Card,
  Grid,
  Avatar,
} from "@servicetitan/anvil2";
import BorderClear from "@servicetitan/anvil2/assets/icons/material/round/border_clear.svg";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Recent Activity</Popover.Button>
        <Popover.Content style={{ maxWidth: "360px" }}>
          <Flex direction="column" gap="4">
            <Flex justifyContent="space-between">
              <Text variant="headline" size="small" el="h4">
                Activity
              </Text>
              <Flex gap="1">
                <Button
                  appearance="ghost"
                  size="small"
                  icon={BorderClear}
                  onClick={console.log}
                />
                <Button
                  appearance="ghost"
                  size="small"
                  icon={BorderClear}
                  onClick={console.log}
                />
                <Button
                  appearance="ghost"
                  size="small"
                  icon={BorderClear}
                  onClick={console.log}
                />
              </Flex>
            </Flex>
            <Flex direction="column" gap="1">
              <Card padding="small">
                <Grid templateColumns="1fr auto" gap="4">
                  <Avatar name="Dog01" size="large" />
                  <Flex direction="column" gap="1">
                    <Text size="small">
                      <b>John mentioned you</b>{" "}
                      <Text inline subdued size="small">
                        9:55am
                      </Text>
                    </Text>
                    <Text subdued size="small">
                      If this is lorem ipsum, then what is not lorem ipsum?
                      Consider this.
                    </Text>
                  </Flex>
                </Grid>
              </Card>
              <Card padding="small">
                <Grid templateColumns="1fr auto" gap="4">
                  <Avatar name="Dog01" size="large" />
                  <Flex direction="column" gap="1">
                    <Text size="small">
                      <b>Jane Doe updated a job appointment</b>{" "}
                      <Text inline subdued size="small">
                        Yesterday
                      </Text>
                    </Text>
                    <Text subdued size="small">
                      Only [x jobs] remaining to work.
                    </Text>
                  </Flex>
                </Grid>
              </Card>
              <Card padding="small">
                <Grid templateColumns="1fr auto" gap="4">
                  <Avatar name="Dog01" size="large" />
                  <Flex direction="column" gap="1">
                    <Text size="small">
                      <b>ST Calendar</b>{" "}
                      <Text inline subdued size="small">
                        3 months ago
                      </Text>
                    </Text>
                    <Text subdued size="small">
                      5 minutes until this event: Hello.
                    </Text>
                  </Flex>
                </Grid>
              </Card>
            </Flex>
          </Flex>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Summary

Combines an identity header, a `Divider`, and a `Toolbar` of contact actions. Use when the peek should both identify the entity and offer immediate next steps.

peek-summary

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-summary?file=src/App.tsx)

```tsx lines theme={null}
import {
  Popover,
  Flex,
  Avatar,
  Text,
  Toolbar,
  Divider,
} from "@servicetitan/anvil2";
import Mail from "@servicetitan/anvil2/assets/icons/material/round/mail.svg";
import Chat from "@servicetitan/anvil2/assets/icons/material/round/chat.svg";
import Phone from "@servicetitan/anvil2/assets/icons/material/round/phone.svg";
import Event from "@servicetitan/anvil2/assets/icons/material/round/event.svg";
import History from "@servicetitan/anvil2/assets/icons/material/round/history.svg";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Jane Doe</Popover.Button>
        <Popover.Content>
          <Flex gap="3">
            <Avatar name="Dog01" size="large" />
            <Flex direction="column">
              <Text>
                <b>Jane Doe</b>
              </Text>
              <Text subdued size="small">
                Customer since 2018
              </Text>
            </Flex>
          </Flex>
          <Toolbar
            associatedContent="playground toolbar"
            additionalItems={[
              <Toolbar.Button
                key="settings"
                onClick={() => console.log("Settings clicked")}
              >
                Settings
              </Toolbar.Button>,
              <Toolbar.Button
                key="help"
                onClick={() => console.log("Help clicked")}
              >
                Help
              </Toolbar.Button>,
            ]}
            overflow="collapse"
          >
            <Toolbar.Button
              icon={Mail}
              onClick={() => console.log("Email clicked")}
              aria-label="Email"
            />
            <Toolbar.Button
              icon={Chat}
              onClick={() => console.log("Chat clicked")}
              aria-label="Chat"
            />
            <Toolbar.Button
              icon={Phone}
              onClick={() => console.log("Call clicked")}
              aria-label="Call"
            />
            <Flex grow="1" style={{ height: "25px" }}>
              <Divider vertical />
            </Flex>
            <Toolbar.Button
              icon={Event}
              onClick={() => console.log("Schedule event clicked")}
              aria-label="Schedule event"
            />
            <Toolbar.Button
              icon={History}
              onClick={() => console.log("Jobs list clicked")}
              aria-label="Jobs list"
            />
            <Flex grow="1" style={{ height: "25px" }}>
              <Divider vertical />
            </Flex>
          </Toolbar>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Simple

Presents an identity header above a collapsing `Toolbar`. Use for a compact peek that keeps actions available while letting them collapse into an overflow menu when space is limited.

peek-simple

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-simple?file=src/App.tsx)

```tsx lines theme={null}
import { Popover, Flex, Avatar, Text, Toolbar } from "@servicetitan/anvil2";
import Phone from "@servicetitan/anvil2/assets/icons/material/round/phone.svg";
import Mail from "@servicetitan/anvil2/assets/icons/material/round/mail.svg";
import Location from "@servicetitan/anvil2/assets/icons/material/round/location_on.svg";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Jane Doe</Popover.Button>
        <Popover.Content>
          <Flex gap="3">
            <Avatar name="Dog01" size="large" />
            <Flex direction="column">
              <Text>
                <b>Jane Doe</b>
              </Text>
              <Text subdued size="small">
                Customer since 2018
              </Text>
            </Flex>
          </Flex>
          <Toolbar
            associatedContent="playground toolbar"
            overflow="collapse"
            direction="vertical"
          >
            <Toolbar.Button
              icon={Phone}
              onClick={() => console.log("Call clicked")}
              aria-label="Call"
              justifyContent="start"
            >
              +1 (555) 555-5555
            </Toolbar.Button>
            <Toolbar.Button
              icon={Mail}
              onClick={() => console.log("Email clicked")}
              aria-label="Email"
              justifyContent="start"
            >
              janedoe@servicetitan.com
            </Toolbar.Button>
            <Toolbar.Button
              icon={Location}
              onClick={() => console.log("Address clicked")}
              aria-label="Address"
              justifyContent="start"
            >
              123 Main Street Glendale CA 91203
            </Toolbar.Button>
          </Toolbar>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Activity Feed With Actions

Extends the activity feed with a `Button` on each row. Use when every item needs its own action, such as approve or view.

peek-activity-feed-with-actions

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-activity-feed-with-actions?file=src/App.tsx)

```tsx lines theme={null}
import { Popover, Flex, Text, Button, Card, Grid } from "@servicetitan/anvil2";
import BorderClear from "@servicetitan/anvil2/assets/icons/material/round/border_clear.svg";

function App() {
  return (
    <Flex
      justifyContent="center"
      placeItems="center"
      style={{
        paddingBlockEnd: "2rem",
      }}
    >
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Trigger</Popover.Button>
        <Popover.Content style={{ maxWidth: "360px", paddingTop: "8px" }}>
          <Flex direction="column" gap="2">
            <Flex justifyContent="space-between">
              <Text variant="headline" size="small" el="h4">
                Activity
              </Text>
              <Flex gap="1">
                <Button
                  appearance="ghost"
                  size="small"
                  icon={BorderClear}
                  onClick={console.log}
                />
                <Button
                  appearance="ghost"
                  size="small"
                  icon={BorderClear}
                  onClick={console.log}
                />
                <Button
                  appearance="ghost"
                  size="small"
                  icon={BorderClear}
                  onClick={console.log}
                />
              </Flex>
            </Flex>
            <Text variant="eyebrow" size="small">
              Subheader
            </Text>
            <Flex direction="column" gap="1">
              <Card>
                <Grid
                  templateColumns="2fr 1fr"
                  gap="4"
                  style={{ width: "100%" }}
                >
                  <Text size="small">
                    <b>Lorem ipsum dolar emit, nesciunt quia dolor ab</b>
                  </Text>
                  <Grid.Item justifySelf="safe end">
                    <Button size="small">Button</Button>
                  </Grid.Item>
                </Grid>
              </Card>
              <Card>
                <Grid
                  templateColumns="2fr 1fr"
                  gap="4"
                  style={{ width: "100%" }}
                >
                  <Text size="small">
                    <b>Lorem ipsum dolar emit, nesciunt quia dolor ab</b>
                  </Text>
                  <Grid.Item justifySelf="safe end">
                    <Button size="small">Button</Button>
                  </Grid.Item>
                </Grid>
              </Card>
              <Card>
                <Grid
                  templateColumns="2fr 1fr"
                  gap="4"
                  style={{ width: "100%" }}
                >
                  <Text size="small">
                    <b>One liner</b>
                  </Text>
                  <Grid.Item justifySelf="safe end">
                    <Button size="small">Button</Button>
                  </Grid.Item>
                </Grid>
              </Card>
              <Card>
                <Grid
                  templateColumns="2fr 1fr"
                  gap="4"
                  style={{ width: "100%" }}
                >
                  <Text size="small">
                    <b>
                      This is will be a third liner just to see what happens
                      here, lorem ipsum emit.
                    </b>
                  </Text>
                  <Grid.Item justifySelf="safe end">
                    <Button size="small">Button</Button>
                  </Grid.Item>
                </Grid>
              </Card>
            </Flex>
          </Flex>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Empty

Shows an empty-state message inside the peek. Use when an entity has no data to preview yet.

peek-empty

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-empty?file=src/App.tsx)

```tsx lines theme={null}
import { Popover, Text, Flex, Icon } from "@servicetitan/anvil2";
import BorderClear from "@servicetitan/anvil2/assets/icons/material/round/border_clear.svg";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Trigger</Popover.Button>
        <Popover.Content style={{ maxWidth: "300px", paddingTop: "8px" }}>
          <Text variant="headline" size="large" el="h3">
            Header Text
          </Text>
          <Flex
            style={{ minHeight: "200px" }}
            placeItems="center"
            direction="column"
            justifyContent="center"
            gap="4"
          >
            <Icon svg={BorderClear} size="large" />
            <Text subdued size="small" style={{ textAlign: "center" }}>
              This is a potential empty state message, if you needed one.
            </Text>
          </Flex>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```

## Max Width Max Height

Constrains `Popover.Content` to the suggested maximum dimensions. Use as a reference for sizing peek content and keeping it within the recommended bounds.

peek-maxwidthmaxheight

[StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/peek-maxwidthmaxheight?file=src/App.tsx)

```tsx lines theme={null}
import { Popover, Flex, Text } from "@servicetitan/anvil2";

function App() {
  return (
    <Flex justifyContent="center" placeItems="center">
      <Popover open placement="top" disableShift disableFlip>
        <Popover.Button>Trigger</Popover.Button>
        <Popover.Content>
          <Flex
            style={{
              borderColor: "var(--a2-border-color-subdued, #e6e6e6)",
              borderStyle: "dashed",
              borderWidth: "1px",
              borderRadius: "6px",
              maxWidth: "296px",
              minHeight: "476px",
              padding: "20px",
            }}
            direction="column"
            gap="4"
            alignSelf="stretch"
            justifyContent="center"
          >
            <Text subdued size="small" style={{ textAlign: "center" }}>
              Inner Popover content suggested max dimensions (16px padding):
            </Text>
            <Text subdued size="small" style={{ textAlign: "center" }}>
              328px width
            </Text>
            <Text subdued size="small" style={{ textAlign: "center" }}>
              508px height
            </Text>
          </Flex>
        </Popover.Content>
      </Popover>
    </Flex>
  );
}

export default App;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.