Adds a hidden back-to-top link for accessibility purposes.
<BackToTop />
Should be combined with the following sass
.back-to-top
display: none
&:focus-within
display: block
Creates a button. Determines whether to use an <a>
, <Link>
or <button>
element depending on the props passed.
<Button href={'https://superrb.com'} label={'The visible label'} label_a11y={'A separate label for screenreaders'} />
A wrapper component containing providers for all contexts within addons.
<ContextWrapper>
<Layout />
</ContextWrapper>
A cookie banner container user-customisable options for tracking.
<CookieBanner
allowCustomisation={false} {/* Whether to allow users to reject tracking cookies individually */}
allowReject={true} {/* Whether to include a reject button. Automatically false if allowCustomisation=true */}
text="We use cookies to provide and improve our services. Sadly, not the delicious kind. Are you okay with that?"
policyLabel="Curious about cookies?"
/>
Creates a form, with field structure defined by a Yup schema. See full documentation
import { Form } from '@superrb/gatsby-addons/components'
import * as yup from 'yup'
const OPTIONS = [
'Option 1',
'Option 2'
]
const schema = yup.object({
name: yup.string().required(),
select: yup.string().oneOf(OPTIONS).required(), // The `oneOf` validation rule will automatically trigger a select box
message: yup.string().meta({ textarea: true }).required() // Set `textarea: true` in the fields metadata to display a textarea
})
const Page = () => (
<Form action="https://yoursite.com/send" schema={schema} />
)
Renders a button which is automatically set up to toggle the navOpen
property of NavContext
<MenuToggle />
A reusable modal component.
<Modal
name="newsletter" {/* The name used to refer to this modal when using the ModalContext or useModal hook */}
openAfter={5000} {/* If set, the modal will automatically open after the number of ms */}
dismissable={true} {/* If false, the modal will not include a close button and cannot be dismissed.
Use the [`useModal`](../hooks/README.md#useModal) hook to close the modal */}
>
{children}
</Modal>
Adds hidden skip-to links for accessibility.
<SkipTo />
Should be combined with the following sass
.skip-to
display: none
&:focus-within
display: block