Synthèse automatique
mithril-ui-form est un framework déclaratif pour créer des formulaires accessibles et performants dans les applications Mithril, piloté par un schéma JSON.
Points forts
- Génération dynamique de formulaires à partir de JSON
- Prise en charge de la logique conditionnelle d'affichage
- Validation intégrée avec règles personnalisées
- Accessibilité conforme aux normes WCAG 2.1 AA
Limites
- Nécessite une familiarité avec Mithril
- La complexité augmente avec les plugins personnalisés
- Documentation peut être limitée pour des cas avancés
Utilisez cette bibliothèque lorsque vous devez créer rapidement des formulaires complexes et réutilisables dans une application Mithril avec un minimum de code.
Évitez de l'utiliser si votre application n'utilise pas Mithril, ou si vous avez besoin d'un contrôle total sur le rendu des formulaires.
Analyse de sécurité
SûrThis is a documentation file for a Mithril form library. It contains no executable commands, no instructions for agents to perform actions, and no references to sensitive data or dangerous operations.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
Using mithril-ui-form, generate a JSON schema for a contact form with fields: name (text, required), email (email, required), message (textarea, max 500 chars), and a submit button.Create a mithril-ui-form schema for a registration form where an 'Other' radio option reveals an additional 'Please specify' text field.Show me how to define a file upload field in mithril-ui-form with mime type restrictions (images only) and a maximum file size of 5MB.name: mithril-ui-form description: A powerful, declarative framework for creating accessible, high-performance forms in Mithril applications.
Mithril UI Form
mithril-ui-form is a powerful, declarative framework for creating accessible, high-performance forms in Mithril applications. It uses a JSON-based schema to dynamically generate forms with a wide range of features.
Key Features
- Object-based and array-based forms: Support for editing single objects or collections of objects.
- Rich component library: Includes a variety of input types, such as text, textarea, select, checkbox, radio, date, time, and file uploads.
- Conditional logic: Show or hide form fields based on the values of other fields.
- Validation: Built-in support for required fields and custom validation rules.
- Plugin system: Extend the library with custom components and functionality.
- Accessibility: Full compliance with WCAG 2.1 AA standards.
Core Components
The core library, mithril-ui-form, provides the main components for creating forms:
LayoutForm: For creating forms that edit a single object.ArrayLayoutForm: For creating forms that edit a collection of objects.
Plugin System
mithril-ui-form has a plugin system that allows you to extend its functionality with custom components. The mithril-ui-form-plugin package defines the plugin architecture.
Some example plugins include:
mithril-ui-form-leaflet-plugin: Adds a Leaflet map component.mithril-ui-form-rating-plugin: Adds a star rating component.
Form Field Examples
Here are some examples of the form fields you can create with mithril-ui-form.
Automatic id generation
Automatically generate an id for a new object, only if it is undefined. You can also use guid if you need GUID. And instead of type "none", you can also set type "text" and disabled to true. Using type "none" will not show it.
{ "id": "id", type: "none", "autogenerate": "id" }
Text Input
For single-line text input.
{
"id": "name",
"label": "Name",
"type": "text",
"required": true,
"maxLength": 50,
"placeholder": "Enter your full name"
}
Other useful types are url, email, and password.
Text Area
For multi-line text input.
{
"id": "description",
"label": "Description",
"type": "textarea",
"maxLength": 500,
"placeholder": "Enter a description"
}
Number Input
For numeric input. Use integer for whole numbers.
{
"id": "age",
"label": "Age",
"type": "number",
"min": 0,
"max": 120,
"required": true
}
Date and Time
For date and time input. date, time, and datetime types are available.
{
"id": "event_date",
"label": "Event Date",
"type": "datetime",
"required": true
}
Color Picker
For selecting a color.
{
"id": "theme_color",
"label": "Theme Color",
"type": "color"
}
Select Dropdown
For selecting one or more options from a list.
{
"id": "country",
"label": "Country",
"type": "select",
"options": [
{ "id": "us", "label": "United States" },
{ "id": "ca", "label": "Canada" },
{ "id": "mx", "label": "Mexico" }
]
}
Radio Buttons
For selecting a single option from a set of choices.
{
"id": "gender",
"label": "Gender",
"type": "radio",
"options": [
{ "id": "male", "label": "Male" },
{ "id": "female", "label": "Female" },
{ "id": "other", "label": "Other" }
]
}
Checkboxes
For selecting multiple options.
{
"id": "interests",
"label": "Interests",
"type": "checkbox",
"options": [
{ "id": "sports", "label": "Sports" },
{ "id": "music", "label": "Music" },
{ "id": "movies", "label": "Movies" }
]
}
Switch
For a boolean toggle.
{
"id": "notifications",
"label": "Enable Notifications",
"type": "switch"
}
File Upload
For uploading files. The base64 type can be used to store the file as a base64 string.
{
"id": "avatar",
"label": "Avatar",
"type": "file",
"url": "/upload",
"options": [{ "id": "image/*" }]
}
Tags Input
For creating a list of tags.
{
"id": "tags",
"label": "Tags",
"type": "tags"
}
Autocomplete
For a text input with suggestions.
{
"id": "framework",
"label": "JS Framework",
"type": "autocomplete",
"options": [
{ "id": "react", "label": "React" },
{ "id": "vue", "label": "Vue" },
{ "id": "angular", "label": "Angular" }
]
}
Rating
A star rating component (requires the mithril-ui-form-rating-plugin).
{
"id": "satisfaction",
"label": "Satisfaction",
"type": "rating",
"min": 1,
"max": 5
}
Map
For selecting a location on a map (requires the mithril-ui-form-leaflet-plugin).
{
"id": "location",
"label": "Location",
"type": "map",
"required": true
}
Markdown
For displaying static markdown content.
{
"type": "md",
"value": "### Section Title\n\nThis is some informational text."
}
Repeating Sections
To create a list of items, such as a list of editors.
{
"id": "editors",
"label": "Editors",
"repeat": true,
"type": [
{ "id": "name", "label": "Name", "type": "text" },
{ "id": "role", "label": "Role", "type": "text" }
]
}
Conditional Visibility
You can show or hide fields based on the values of other fields using the show property.
{
"id": "is_company",
"label": "Are you a company?",
"type": "switch"
},
{
"id": "company_name",
"label": "Company Name",
"type": "text",
"show": "is_company"
}
This will only show the company_name field when the is_company switch is on. show can also be an array, using multiple properties, e.g. ["color=red", "optionId=4"].
Getting Started
To get started with mithril-ui-form, you can use the example application provided in the example package.
Installation
pnpm install
Development
pnpm start
This will build all the packages and start a development server for the example application.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/mithril-ui-form-framework-mm5t8978' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/mithril-ui-form-framework-mm5t8978/download' --output '.skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md.part' && mv '.skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md.part' '.skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Extrait original : Installation
pnpm install
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md' && test -s '.skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/mithril-ui-form' && cp -R '.skill-downloads/mithril-ui-form-framework-mm5t8978' '.claude/skills/mithril-ui-form'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/mithril-ui-form-framework-mm5t8978'openskills read 'mithril-ui-form-framework-mm5t8978'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/mithril-ui-form-framework-mm5t8978/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.