Give background information before asking a question
const [selectedValue, setSelectedValue] = useState<string>("");
const handleChange = (event: GoabRadioGroupOnChangeDetail) => {
setSelectedValue(event.value as string);
};
const handleSubmit = () => {
console.log("Selected:", selectedValue);
};<GoabxLink leadingIcon="arrow-back" size="small" mb="none">
Back
</GoabxLink>
<GoabText as="h2" mt="xl" mb="m">Current school status</GoabText>
<GoabText mt="none" mb="s">
School can encompass foundational programs that help individuals gain basic skills for
further learning and living, such as literacy and numeracy courses. It also includes
skills and employment training programs, designed to equip you with specific skills for
the job market.
</GoabText>
<GoabText mt="none" mb="s">
Post-secondary education, such as Bachelor's, Master's, or Doctoral degrees, and
continuing education courses for professional or personal development, are also
categorized under 'school'.
</GoabText>
<GoabText mt="none" mb="xl">
Contact your provider if you're concerned about your school status.
</GoabText>
<GoabxFormItem label="Are you currently in school?">
<GoabxRadioGroup
name="school"
ariaLabel="are you currently in school?"
onChange={handleChange}>
<GoabxRadioItem value="yes" label="Yes" />
<GoabxRadioItem value="no" label="No" />
</GoabxRadioGroup>
</GoabxFormItem>
<GoabxButton type="submit" mt="2xl" onClick={handleSubmit}>
Save and continue
</GoabxButton>
);
}h2.section-title {
margin-bottom: var(--goa-space-l);
}
a.back-link::before {
content: "";
display: inline-block;
width: 42px;
height: 24px;
vertical-align: middle;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 2 22 22" fill="none" stroke="%230070C4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg>') center center no-repeat;
}
a.back-link:visited::before,
a.back-link:hover::before {
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 2 22 22" fill="none" stroke="%23004f84" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg>') center center no-repeat;
}
a.back-link {
margin-top: var(--goa-space-m);
}
:host a.back-link + h2 {
margin-top: var(--goa-space-2xl);
}selectedValue = "";
onChange(event: GoabRadioGroupOnChangeDetail): void {
this.selectedValue = event.value as string;
}
onSubmit(): void {
console.log("Selected:", this.selectedValue);
}<goabx-link leadingIcon="arrow-back" size="small" mb="none">
Back
</goabx-link>
<goab-text as="h2" mt="xl" mb="m">Current school status</goab-text>
<goab-text mt="none" mb="s">
School can encompass foundational programs that help individuals gain basic skills for
further learning and living, such as literacy and numeracy courses. It also includes
skills and employment training programs, designed to equip you with specific skills for
the job market.
</goab-text>
<goab-text mt="none" mb="s">
Post-secondary education, such as Bachelor's, Master's, or Doctoral degrees, and
continuing education courses for professional or personal development, are also
categorized under 'school'.
</goab-text>
<goab-text mt="none" mb="xl">
Contact your provider if you're concerned about your school status.
</goab-text>
<goabx-form-item label="Are you currently in school?">
<goabx-radio-group
name="school"
ariaLabel="are you currently in school?"
(onChange)="onChange($event)">
<goabx-radio-item value="yes" label="Yes"></goabx-radio-item>
<goabx-radio-item value="no" label="No"></goabx-radio-item>
</goabx-radio-group>
</goabx-form-item>
<goabx-button type="submit" mt="2xl" (onClick)="onSubmit()">
Save and continue
</goabx-button>const radioGroup = document.getElementById('school-radio');
const submitBtn = document.getElementById('submit-btn');
let selectedValue = '';
radioGroup.addEventListener('_change', (e) => {
selectedValue = e.detail.value;
});
submitBtn.addEventListener('_click', () => {
console.log('Selected:', selectedValue);
});<goa-link leadingicon="arrow-back" size="small" mb="none">
Back
</goa-link>
<goa-text as="h2" mt="xl" mb="m">Current school status</goa-text>
<goa-text mt="none" mb="s">
School can encompass foundational programs that help individuals gain basic skills for
further learning and living, such as literacy and numeracy courses. It also includes
skills and employment training programs, designed to equip you with specific skills for
the job market.
</goa-text>
<goa-text mt="none" mb="s">
Post-secondary education, such as Bachelor's, Master's, or Doctoral degrees, and
continuing education courses for professional or personal development, are also
categorized under 'school'.
</goa-text>
<goa-text mt="none" mb="xl">
Contact your provider if you're concerned about your school status.
</goa-text>
<goa-form-item version="2" label="Are you currently in school?">
<goa-radio-group version="2" id="school-radio" name="school" arialabel="are you currently in school?">
<goa-radio-item value="yes" label="Yes"></goa-radio-item>
<goa-radio-item value="no" label="No"></goa-radio-item>
</goa-radio-group>
</goa-form-item>
<goa-button version="2" id="submit-btn" type="submit" mt="2xl">
Save and continue
</goa-button>Provide explanatory context before asking a question to help users understand what is being asked.
When to use
Use this pattern when:
- The question requires domain knowledge to answer correctly
- Terms need clarification for users unfamiliar with the subject
- Providing context will reduce confusion and incorrect answers
- Building citizen-facing forms where accessibility of information is important
Considerations
- Place context information before the question, not after
- Use clear, plain language that citizens can understand
- Suggest where users can get additional help if needed
- Keep explanatory text focused and relevant to the question
- Use appropriate heading hierarchy for screen reader accessibility