Link
A slightly modified version of link.ts from the Payload website template. The original can be found here.
Usage
TypeScript
1import { link } from '@/src/payload/fields/link';
2
3// Basic usage
4link()
5
6// With options
7link({
8 appearances: ['default', 'outline'],
9 localizedLabel: true,
10 required: true,
11})Note: The import path above reflects the LayoutBlocks repo structure. Adjust it to match where you place the field file in your own project.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
appearances | LinkAppearances[] | false | ['default', 'outline'] | Which appearance options to show. Pass false to hide. |
disableLabel | boolean | false | Removes the label field from the group. |
localizedLabel | boolean | false | Makes the label field localizable. |
overrides | Partial<GroupField> | {} | Deep-merged into the generated group field. |
required | boolean | false | Makes the reference/URL and label fields required. |
What's Different
localizedLabel— Added prop that passeslocalized: trueto the label text field when enabled.required— Added prop that makes the reference, URL, and label fields required when enabled.