- Welcome
- Getting started
- Monthly update
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria Live
- Autosuggest
- Badge
- Banner Alert
- Bar Chart
- Blockquote
- Bottom Navigation
- Bottom Sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card Button
- Carousel
- Checkbox
- Chip
- Code
- Content Cards
- Data Table
- Datepicker
- Description List
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat List
- Flight Leg
- Floating Action Button
- Floating Notification
- Form Label
- Form Validation
- Graphic Promotion
- Horizontal Navigation
- Icon
- Image
- Infinite Scroll
- Link
- List
- Map
- Mobile Scroll Container
- Modal
- Navigation Bar
- Nudger
- Overlay
- Page Indicator
- Pagination
- Panel
- Phone Input
- Picker
- Popover
- Price
- Progress Bar
- Radio Button
- Rating
- Scrollable Calendar
- Section List
- Select
- Skeleton
- Skip Link
- Slider
- Snackbar
- Spinner
- Split Input
- Star Rating
- Switch
- Table
- Text
- Text Input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable Native Feedback
- Touchable Overlay
- Content
- Accessibility
Button
Buttons help our travellers make all kinds of action, from logging in to booking that dream trip.
Button
Primary
Day | Night |
---|---|
![]() |
![]() |
PrimaryOnLight
Day | Night |
---|---|
![]() |
![]() |
PrimaryOnDark
Day | Night |
---|---|
![]() |
![]() |
Secondary
Day | Night |
---|---|
![]() |
![]() |
Featured
Day | Night |
---|---|
![]() |
![]() |
Destructive
Day | Night |
---|---|
![]() |
![]() |
Link
Day | Night |
---|---|
![]() |
![]() |
Usage
Basic button with a title and action closure.
If you don't specify a .buttonStyle(<type>) it will use the .primary type
BPKButton("Button title") {
print("Button tap closure")
}
Styled .secondary Button.
```swift BPKButton("Button title") { print("Button tap closure") } .buttonStyle(.secondary)
### Button with a title and icon.
Set the icon to:
* `.leading(icon: <BPKIcon>)`
* `.trailing(icon: <BPKICon>)`
swift BPKButton( "Button title", icon: .leading(icon: .longArrowRight) ) { print("Button tap closure") }
BPKButton( "Button title", icon: .trailing(icon: .longArrowRight) ) { print("Button tap closure") }
### Button with loading state.
Pass in a `@State` variable or use `.constant(true)`
swift BPKButton( "Button title", loading: $isLoading ) { print("Button tap closure") }
### Button with disabled state.
Pass in a `@State` variable or use `.constant(true)`
swift BPKButton( "Button title", enabled: $isEnabled ) { print("Button tap closure") }
### Button with icon only
> Pass in `accessibilityLabel` when creating a button with just an icon
swift BPKButton( icon: .longArrowRight, accessibilityLabel: "Button label" ) { print("Button tap closure") }
### Button with large size
swift BPKButton( "Button title", size: .large ) { print("Button tap closure") } ```
Made with ❤️ by Skyscanner © 2023
© 2023 Skyscanner Backpack. Page last updated on Nov 21, 2022, 15:07