RuleWithFormMeta
API / @publicodes/forms / RuleWithFormMeta
type RuleWithFormMeta = Rule & object &
| {
form: {
saisie: "case à cocher" | "oui/non";
};
type: "booléen";
}
| {
form: {
orientation: "horizontal" | "vertical";
saisie: "menu déroulant" | "boutons radio" | "cartes";
};
une possibilité: unknown;
}
| {
form: {
saisie: "texte court" | "texte long";
};
type: "texte";
}
| {
form: {
saisie: "année" | "mois";
};
type: "date";
} & object;
Defined in: index.ts:48
A Publicodes Rule with additional metadata for form input.
These metadata are used to customize the user interface directly from Publicodes rules. They determine the type of input to display, labels, descriptions, and the order of questions.
In YAML, these metadata are added with the form
key:
TJM:
description: |
Tarif journalier hors taxe facturé aux clients.
Généralement entre 300 et 800 €/jour.
unité: €/jour facturé
form:
position: 1
label: Tarif journalier
description: Indiquez votre tarif journalier hors taxe
The form metadata can customize:
- Input type (checkbox, radio buttons, dropdown, text, etc.)
- Labels and descriptions
- Question order/priority
The rule can have different input types and configurations based on its type.
Type declaration
Name | Type | Description | Defined in |
---|---|---|---|
type ? | "date" | "nombre" | "texte" | "booléen" | The data type of the rule. This affects what input controls are available in the form. | index.ts:53 |
Type declaration
Name | Type | Description | Defined in |
---|---|---|---|
form | object | - | index.ts:141 |
form.description ? | string | Detailed description to display below the input field. This can provide additional context or instructions to the user. | index.ts:152 |
form.label ? | string | Custom label to display for this input field. If not provided, the rule’s name or description will be used. | index.ts:146 |
form.position ? | number | Controls the order/priority of questions. Lower numbers will be displayed first Negative numbers will be displayed last | index.ts:159 |