{ "component": "select", "fixtures": [ { "name": "default", "options": { "id": "select-1", "name": "select-1", "label": { "text": "Label text goes here" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2", "selected": true }, { "value": 3, "text": "GOV.UK frontend option 3", "disabled": true } ] }, "html": "
\n \n\n\n \n
", "hidden": false }, { "name": "with hint text and error message", "options": { "id": "select-2", "name": "select-2", "label": { "text": "Label text goes here" }, "hint": { "text": "Hint text goes here" }, "errorMessage": { "text": "Error message goes here" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2" }, { "value": 3, "text": "GOV.UK frontend option 3" } ] }, "html": "
\n \n\n \n \n
\n Hint text goes here\n
\n\n\n \n \n \n Error: Error message goes here\n \n\n \n
", "hidden": false }, { "name": "with label as page heading", "options": { "id": "select-3", "name": "select-3", "label": { "text": "Label text goes here", "isPageHeading": true }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2", "selected": true }, { "value": 3, "text": "GOV.UK frontend option 3", "disabled": true } ] }, "html": "
\n

\n \n

\n\n\n \n
", "hidden": false }, { "name": "with full width override", "options": { "id": "select-1", "name": "select-1", "classes": "govuk-!-width-full", "label": { "text": "Label text goes here" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2", "selected": true }, { "value": 3, "text": "GOV.UK frontend option 3", "disabled": true } ] }, "html": "
\n \n\n\n \n
", "hidden": false }, { "name": "with optional form-group classes", "options": { "id": "select-1", "name": "select-1", "classes": "govuk-!-width-full", "label": { "text": "Label text goes here" }, "formGroup": { "classes": "extra-class" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2", "selected": true }, { "value": 3, "text": "GOV.UK frontend option 3", "disabled": true } ] }, "html": "
\n \n\n\n \n
", "hidden": false }, { "name": "with describedBy", "options": { "id": "with-describedby", "name": "with-describedby", "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2" } ], "describedBy": "some-id" }, "html": "
\n \n\n\n \n
", "hidden": true }, { "name": "attributes", "options": { "id": "with-attributes", "name": "with-attributes", "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2" } ], "attributes": { "data-attribute": "my data value" } }, "html": "
\n \n\n\n \n
", "hidden": true }, { "name": "attributes on items", "options": { "id": "with-item-attributes", "name": "with-item-attributes", "value": 2, "items": [ { "text": "Option 1", "value": 1, "attributes": { "data-attribute": "ABC", "data-second-attribute": "DEF" } }, { "text": "Option 2", "value": 2, "attributes": { "data-attribute": "GHI", "data-second-attribute": "JKL" } } ] }, "html": "
\n \n\n\n \n
", "hidden": true }, { "name": "with falsey values", "options": { "id": "with-falsey-values", "name": "with-falsey-values", "items": [ { "text": "Option 1", "value": 1 }, null, false, "", { "text": "Options 2", "value": 2 } ] }, "html": "
\n \n\n\n \n
", "hidden": true }, { "name": "hint", "options": { "id": "select-with-hint", "name": "select-with-hint", "hint": { "text": "Hint text goes here" } }, "html": "
\n \n\n \n \n
\n Hint text goes here\n
\n\n\n \n
", "hidden": true }, { "name": "hint and describedBy", "options": { "id": "select-with-hint", "name": "select-with-hint", "describedBy": "some-id", "hint": { "text": "Hint text goes here" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2" } ] }, "html": "
\n \n\n \n \n
\n Hint text goes here\n
\n\n\n \n
", "hidden": true }, { "name": "error", "options": { "id": "select-with-error", "name": "select-with-error", "errorMessage": { "text": "Error message" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2" } ] }, "html": "
\n \n\n\n \n \n \n Error: Error message\n \n\n \n
", "hidden": true }, { "name": "error and describedBy", "options": { "id": "select-with-error", "name": "select-with-error", "describedBy": "some-id", "errorMessage": { "text": "Error message" }, "items": [ { "value": 1, "text": "GOV.UK frontend option 1" }, { "value": 2, "text": "GOV.UK frontend option 2" } ] }, "html": "
\n \n\n\n \n \n \n Error: Error message\n \n\n \n
", "hidden": true } ] }