Used to trigger actions, submit forms, or navigate users through the application. The Button
component is highly customizable, supporting various styles, icons, loading states, and sizes to fit different use cases.
Usage
Import
import { Button } from '@passfort/castle'content_copyCopy
Styles
Use the type prop to change the Button's appearance and behavior. Available types include:
- default,
- primary,
- positive,
- negative,
- read-only,
- disabled,
- stroke,
- submit,
- text,
- ghost, and
- active.
content_copyCopy
live example
Icons
Use the icon
and iconRight
props to add icons to the left and right sides of the button, respectively.
content_copyCopy
live example
Icon only
Create buttons that contain only an icon without any label. This is useful for actions like close buttons or toggles.
content_copyCopy
live example
Loading
content_copyCopy
live example
Connected Buttons
Use the Connected
component with a custom group prop to achieve a connected button effect. By default, buttons belong to the group="button"
.
import { Connected } from '@passfort/castle'content_copyCopy
content_copyCopy
live example
Small buttons
Toggle the small
prop to render smaller versions of the button, suitable for compact interfaces or denser layouts.
content_copyCopy
live example
Customisation
Customize the button's content and structure using sub-components like Button.Icon
and Button.Text
. This allows for more complex button layouts and integrations.
content_copyCopy
live example
HTML Submit
Use buttons with the type="submit"
prop within form elements to handle form submissions.
content_copyCopy
live example