Renders the slug of a dump or a playlist, the last segment of its page's path, in their edit forms. A slug changes only from here: a new title proposes one, which saving applies, and the old one stays an alias of the item on the server.
Renders the slug's input after its path, and its error. Until the user types in it, it follows the title,
proposing slugify(title), or the saved slug when the title slugifies as
the saved one does. It must sit under a react-hook-form FormProvider.
Passed to SlugField by DumpEdit's and PlaylistEditForm's forms,
which send the slug only when it differs from saved.slug.
-
inputClassName: string
For a form outside
.form, whose inputs take their own class. -
name: Path<T>
The form's slug field.
-
prefix: string
The page's path up to the slug, such as
/@bob/dumps/. -
saved: { title: string; slug: string; }
The item as saved, whose slug a title put back to its own restores.
-
titleName: Path<T>
The form's title field, which the slug follows until it is typed in.
Usage
import * as mod from "src/components/form/SlugField.tsx";