@owlmeans/client-panel
v0.1.11
Published
Schema-driven React form components with react-hook-form integration, i18n, and action buttons.
Downloads
2,024
Readme
@owlmeans/client-panel
Schema-driven React form components with react-hook-form integration, i18n, and action buttons.
Overview
ClientForm— form wrapper with react-hook-form, AJV schema validation, and submit handlingActionCtrl— i18n-aware button component for form actions (submit, cancel, etc.)InputCtrl— labeled input field component backed by react-hook-formuseFormRef()— hook to get a ref for programmatic form operationsFormOnSubmit— type for form submission handler functions- Platform-agnostic: used by React web and React Native frontends
Installation
bun add @owlmeans/client-panelUsage
A complete form with submit and cancel actions:
import { ClientForm, InputCtrl, ActionCtrl, useFormRef } from '@owlmeans/client-panel'
import type { FormOnSubmit } from '@owlmeans/client-panel'
function CreateProjectForm() {
const formRef = useFormRef()
const onSubmit: FormOnSubmit<CreateProject> = async (data) => {
await ctx.module<ClientModule<Project>>('project-create').call({ body: data })
}
return (
<ClientForm schema={createProjectSchema} onSubmit={onSubmit} ref={formRef}>
<InputCtrl name="title" />
<InputCtrl name="description" />
<ActionCtrl i18nKey="project.create.submit" type="submit" />
<ActionCtrl i18nKey="project.create.cancel" onClick={() => navigate.go('project-list')} />
</ClientForm>
)
}API
ClientForm
React component. Props:
schema: AJVSchema— AJV schema used for validation and default valuesonSubmit: FormOnSubmit<T>— called with validated form dataref?—useFormRef()ref for programmatic reset/submit
ActionCtrl
React component for buttons. Props:
i18nKey: string— translation key for button labeltype?: 'submit' | 'button' | 'reset'onClick?: () => voiddisabled?: boolean
InputCtrl
React component for labeled inputs. Props:
name: string— field name from the schematype?: string— input type (text, email, password, etc.)i18nKey?: string— translation key for label (defaults to field name)
useFormRef(): FormRef
Returns a ref object for programmatic form control.
FormOnSubmit<T>
type FormOnSubmit<T> = (data: T) => void | Promise<void>schemaToFormDefault(schema): Record<string, any>
Derives default form values from an AJV schema's default fields.
Related Packages
@owlmeans/client—useContext,useNavigateused within form components@owlmeans/client-i18n— i18n provider required byActionCtrl/InputCtrl
Agent guidance
This package ships embedded Claude Code skills and GitHub Copilot instructions under
agent-meta/. After installing your @owlmeans/* packages, run the OwlMeans
agent-skills installer to place them into your project's native locations
(.claude/skills/ and .github/instructions/):
npx @owlmeans/agent-skillsThe embedded files are version-matched to this package release. Do not edit them directly — they are regenerated on each publish. To contribute guidance edits, open a PR against the source monorepo.
