Naming conventions of types
You can import some types that we provide to our components like so:
import type { ButtonProps } from '@kinsta/stratus'
We usually name the types by giving it the name of the component and one of the following suffixes: Props
, Interface
or Component
. This gives us names like ButtonProps
, NotePanelInterface
.
Sometimes components don't have all of these types. Please take a look at the components' docs and if you find that there's something you need that we don't provide let the stratus team know about it.
...Props
suffix:
Props that are implemented and processed by Stratus.
This may include some HTML element props such as onClick
and style
.
If you see these props there, we might be changing its behaviour inside the Stratus component, so take a look at the specific documentation of the prop itself on the component's documentation page.
Example:
interface RadioCardProps {
isChecked?: boolean
isInFocus?: boolean
isInGroup?: boolean
value?: string
ctaButton?: CtaButtonType | null
onChange?: (value?: string) => void
isDisabled?: boolean
}
...Interface
suffix:
The ...Props
type extended by default HTMLElement types such as style, class etc. Inaccessible HTMLElement types are omitted.
Example:
interface RadioCardInterface extends RadioCardProps, Omit<Omit<InputHTMLAttributes<HTMLDivElement>, 'value'>, 'onChange'> {}
...Component
suffix:
The ...Interface
extended by JSX.Element type
ForwardRefExoticComponent<...Props/...Interface & RefAttributes<HTML...Element>>
ComponentType<...Props/...Interface>
(props: ...Props/...Interface) => JSX.Element
Example for RadioCard
that has a Content
subcomponent:
export type RadioCardComponent = ComponentType<RadioCardInterface> & { Content: ComponentType<RadioCardContentProps> }
There are other types as well, such as ButtonTypes
and IconName
, which indicate what values can be given to the Button
's props.
To be sure that you don't miss these, consult the specific component's documentation and if you see anything missing, please let the stratus team know!
type ButtonTypes = 'primary' | 'secondary' | 'tertiary' | 'danger' type IconName = keyof typeof icons interface ButtonProps { type?: ButtonTypes icon?: IconName ... }
If you're developing Stratus and you'd like more information on how we use types, visit the developer guide on types