Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
33 lines
1.3 KiB
Plaintext
33 lines
1.3 KiB
Plaintext
import React from 'react';
|
|
/**
|
|
* All fields are wrapped in a `FieldPathContext` provider by default.
|
|
* The `useFieldPath` hook will return this value if it exists, not the path the field was explicitly given.
|
|
* This means if you render a field directly, you will need to wrap it with a new `FieldPathContext` provider.
|
|
* Otherwise, it will return the parent's path, not the path it was explicitly given.
|
|
* @example
|
|
* ```tsx
|
|
* 'use client'
|
|
* import React from 'react'
|
|
* import { TextField, FieldPathContext } from '@payloadcms/ui'
|
|
* import type { TextFieldClientComponent } from 'payload'
|
|
*
|
|
* export const MyCustomField: TextFieldClientComponent = (props) => {
|
|
* return (
|
|
* <FieldPathContext value="path.to.some.other.field">
|
|
* <TextField {...props} />
|
|
* </FieldPathContext>
|
|
* )
|
|
* }
|
|
* ```
|
|
*
|
|
* @experimental This is an experimental API and may change at any time. Use at your own risk.
|
|
*/
|
|
export declare const FieldPathContext: React.Context<string>;
|
|
/**
|
|
* Gets the current field path from the nearest `FieldPathContext` provider.
|
|
* All fields are wrapped in this context by default.
|
|
*
|
|
* @experimental This is an experimental API and may change at any time. Use at your own risk.
|
|
*/
|
|
export declare const useFieldPath: () => string;
|
|
//# sourceMappingURL=context.d.ts.map |