<Card> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> </Card>
<Card> <Stack space="large"> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> </Stack> </Card>
Now that we have described how we want to manage the space within the `Card`, we can add more fields to the form by placing them within this `Stack`.
Let’s add a TextField, MonthPicker and a Textarea, providing each of them with a `label`.
<Card> <Stack space="large"> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> <TextField label="Company name" /> <MonthPicker label="Started" /> <Textarea label="Description" /> </Stack> </Card>
Sometimes it is necessary to provide more information to a field, either adding additional context, indicating whether a field is optional, or even providing field specific help. All fields within Braid support a `secondaryLabel`, `tertiaryLabel` and `description`.
Let’s encourage the users of this form to provide a description by marking it as “recommended” using the `secondaryLabel`.
<Card> <Stack space="large"> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> <TextField label="Company name" /> <MonthPicker label="Started" /> <Textarea label="Description" secondaryLabel="recommended" /> </Stack> </Card>
While we’re at it, we can also add a `description` to provide more context to the user—prompting them with what sort of information they should provide.
<Card> <Stack space="large"> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> <TextField label="Company name" /> <MonthPicker label="Started" /> <Textarea label="Description" secondaryLabel="recommended" description="Summarise your responsibilities, skills and achievements." /> </Stack> </Card>
<Card> <Stack space="large"> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> <TextField label="Company name" /> <MonthPicker label="Started" /> <Textarea label="Description" secondaryLabel="recommended" description="Summarise your responsibilities, skills and achievements." /> <Button>Save</Button> </Stack> </Card>
You’ll notice the button is the full width of the card. This is fine from a mobile perspective, but less that ideal on a larger device.
We can address this by wrapping the button in an Actions component. Now it will be full width on mobile and only as wide as its content on larger screens.
<Card> <Stack space="large"> <Heading level="3">Add role</Heading> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> <TextField label="Company name" /> <MonthPicker label="Started" /> <Textarea label="Description" secondaryLabel="recommended" description="Summarise your responsibilities, skills and achievements." /> <Actions> <Button>Save</Button> </Actions> </Stack> </Card>
<Card> <Stack space="xlarge"> <Heading level="3">Add role</Heading> <Stack space="large"> <Autosuggest label="Job title" suggestions={filterSuggestions([ { text: "Developer" }, { text: "Designer" }, { text: "Product Manager" }, ])} /> <TextField label="Company name" /> <MonthPicker label="Started" /> <Textarea label="Description" secondaryLabel="recommended" description="Summarise your responsibilities, skills and achievements." /> </Stack> <Actions> <Button>Save</Button> </Actions> </Stack> </Card>