UI Components
Organisms
Region Modal

Region Modal

It's a Modal with some region configurations. The component is part of Regionalization feature.

Import

Import the component from @faststore/ui

import { RegionModal } from '@faststore/ui'

Import Styles

import '@faststore/ui/src/components/organisms/RegionModal/styles.scss'

Usage


Props

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing-library, and jest).fs-region-modal
titlestringThe region modal's title.Set your location
descriptionstringDescription for region modal.Prices, offers and availability may vary according to your location.
idkPostalCodeLinkPropsPartial<LinkProps<LinkElementType>>Props for the link `I don't know my Postal Code`.
linkTextPartial<LinkProps<LinkElementType>>Props for the `I don't know my Postal Code` link on modal body content.
errorMessagestringMessage of error for input.
inputRefMutableRefObject<HTMLInputElement>Postal code input's ref.
inputValuestringPostal code input's value.
fadeOutOnSubmitfalse | trueEnables fadeOut effect on modal after onSubmit function
overlayPropsPropsProps forwarded to the `Overlay` component.
onClose() => voidFunction called when Close button is clicked.
onInput(event: React.FormEvent<HTMLInputElement>) => voidCallback function when input is typed.
onSubmit() => voidCallback function when form is submitted.
onClear() => voidCallback function when the input clear button is clicked.
aria-labelledbystringIdentifies the element (or elements) that labels the current element. @see aria-labelledby https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby
isOpenfalse | trueA boolean value that represents the state of the Modal
onDismiss() => voidEvent emitted when the modal is closed

Design Tokens

Local tokenDefault value/Global token linked
--fs-region-modal-margin-bottomvar(--fs-spacing-6)
--fs-region-modal-link-padding0
--fs-region-modal-link-column-gapvar(--fs-spacing-0)
--fs-region-modal-link-color
var(--fs-color-link)

Customization

For further customization, you can use the following data attributes:

data-fs-region-modal

data-fs-region-modal-input

data-fs-region-modal-link