---
title: ErrorPill
label: ErrorPill
order: 140
desc: Display a compact validation error count with Payload's ErrorPill component.
keywords: ui, component, error, validation, count, pill
---

The `ErrorPill` component displays the number of validation errors associated with a field or group of fields. It returns `null` when the count is zero.

## Import

Inside a Payload Admin Panel Custom Component:

```tsx
import { ErrorPill, useTranslation } from '@payloadcms/ui'
```

You can also import the component directly:

```tsx
import { ErrorPill } from '@payloadcms/ui/elements/ErrorPill'
import { useTranslation } from '@payloadcms/ui/providers/Translation'
```

## Counts

<ComponentPreview component="ErrorPill" example="counts" />

Pass the `i18n` object from `useTranslation`. Add `withMessage` when the count needs a localized “error” or “errors” label.

## Common props

These are the props most commonly used with this component. See its exported types in `@payloadcms/ui` for the complete list.

| Prop          | Type         | Default | Description                                      |
| ------------- | ------------ | ------- | ------------------------------------------------ |
| `count` \*    | `number`     | —       | Number of errors. Renders nothing when set to 0. |
| `i18n` \*     | `I18nClient` | —       | Supplies localized error labels.                 |
| `withMessage` | `boolean`    | `false` | Displays “error” or “errors” after the count.    |
| `className`   | `string`     | —       | Adds a custom class to the element.              |

_\* An asterisk denotes that a prop is required._
