CheckboxOne
Permet de sélectionner une valeur parmi une liste d'option. Le fonctionnement est similaire à celui des radios si ce n'est que la case peut être décochable.
- Source
- Data
{
"$schema": "../../../lunatic-schema.json",
"maxPage": "1",
"components": [
{
"id": "checkboxone",
"componentType": "CheckboxOne",
"mandatory": false,
"page": "1",
"label": {
"value": "\"checkboxone ONE component\"",
"type": "VTL|MD"
},
"description": {
"value": "\"true or false\"",
"type": "VTL|MD"
},
"conditionFilter": {
"value": "true",
"type": "VTL"
},
"options": [
{
"value": "1",
"description": {
"value": "\"Déclaration oui\"",
"type": "VTL|MD"
},
"label": {
"value": "\"oui\"",
"type": "VTL|MD"
}
},
{
"value": "2",
"description": {
"value": "\"Déclaration non\"",
"type": "VTL|MD"
},
"label": {
"value": "\"non\"",
"type": "VTL|MD"
}
}
],
"response": {
"name": "Q2"
}
}
],
"variables": [
{
"variableType": "COLLECTED",
"name": "Q2",
"values": {
"PREVIOUS": null,
"COLLECTED": null,
"FORCED": null,
"EDITED": null,
"INPUTTED": null
}
}
]
}
{}
- Code
- Rendu
import {
type LunaticData,
type LunaticSource,
useLunatic,
LunaticComponents,
} from '@inseefr/lunatic';
import '@inseefr/lunatic/lib/main.css'
type Props = {
source: LunaticSource;
data: LunaticData;
};
export function FormRenderer({ source, data }: Props) {
const { getComponents, Provider } = useLunatic(source, data, {
initialPage: '1',
});
return (
<Provider>
<LunaticComponents components={getComponents()} />
</Provider>
);
}
Loading...