- Welcome
- Getting started
- Latest updates
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- App Search Modal
- Aria live
- Autosuggest
- Badge
- Banner alert
- Bar chart
- Blockquote
- Bottom navigation
- Bottom sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card list
- Card button
- Carousel
- Checkbox
- Chip
- Chip group
- 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
- Image Gallery
- Infinite scroll
- Info Banner
- Inset Banner
- Link
- List
- Map
- Mobile scroll container
- Modal
- Navigation bar
- Navigation Tab Group
- Nudger
- Overlay
- Page indicator
- Pagination
- Panel
- Phone input
- Picker
- Popover
- Price
- Progress bar
- Radio button
- Rating
- Rating Bar
- Scrollable calendar
- Search Modal
- Section header
- Section list
- Select
- Skeleton
- Skip link
- Slider
- Snackbar
- Snippet
- Spinner
- Split input
- Star rating
- Swap Button
- Switch
- Table
- Text
- Text input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable native feedback
- Touchable overlay
- Search Input Summary
- Content
- Accessibility
- Contributing
- Localisation
Image Gallery
Image Gallery
Carousel
Day | Night |
---|---|
Slideshow
Day | Night |
---|---|
Image Grid
Day | Night |
---|---|
Chip Grid
Day | Night |
---|---|
Installation
Backpack Compose is available through Maven Central. Check the main Readme for a complete installation guide.
Usage
Example of an image gallery carousel:
import net.skyscanner.backpack.compose.carousel.rememberBpkCarouselState
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryCarousel
val state = rememberBpkCarouselState(totalImages = totalImages)
BpkImageGalleryCarousel(
state = state,
modifier = Modifier.height(100.dp),
onImageClicked = { index -> /* handle on click */ },
) { index ->
Image(painter = painterResource(id = imageResAtIndex(index)), contentDescription = "")
}
Example of an image gallery without categories:
import net.skyscanner.backpack.compose.carousel.rememberBpkCarouselState
import net.skyscanner.backpack.compose.imagegallery.BpkImageGallerySlideshow
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryImage
val modalState = rememberBpkModalState()
val coroutineScope = rememberCoroutineScope()
BpkImageGallerySlideshow(
modifier = modifier,
state = modalState,
closeContentDescription = "",
initialImage = 0,
onCloseClicked = { coroutineScope.launch { modalState.hide() } },
onDismiss = { /* handle dismiss */ },
onImageChanged = { /* Handle on image change if needed (ie logging) */ },
images = listOf(
BpkImageGalleryImage(
title = "",
description = "",
credit = "",
content = { contentDescription, contentScale ->
// Image content
},
),
)
)
Example of an image gallery with categories and chips:
import net.skyscanner.backpack.compose.carousel.rememberBpkCarouselState
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryChipCategory
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryChipGrid
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryImage
val modalState = rememberBpkModalState()
val coroutineScope = rememberCoroutineScope()
BpkImageGalleryChipGrid(
modifier = modifier,
state = modalState,
initialCategory = 0,
closeContentDescription = "",
onCloseClicked = { coroutineScope.launch { modalState.hide() } },
onDismiss = { /* handle dismiss */ },
onImageChanged = { /* Handle on image change if needed (ie logging) */ },
onCategoryChanged = { /* Handle on category change if needed (ie logging) */ },
onImageClicked = { /* Handle on image clicked if needed (ie logging) */ },
categories = listOf(
BpkImageGalleryChipCategory(
title = title,
images = listOf(
BpkImageGalleryImage(
title = "",
description = "",
credit = "",
content = { contentDescription, contentScale ->
// Image content
},
),
// more images
),
),
// more categories
),
)
Example of an image gallery with categories and image chips:
import net.skyscanner.backpack.compose.carousel.rememberBpkCarouselState
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryImageCategory
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryImageGrid
import net.skyscanner.backpack.compose.imagegallery.BpkImageGalleryImage
val modalState = rememberBpkModalState()
val coroutineScope = rememberCoroutineScope()
BpkImageGalleryImageGrid(
modifier = modifier,
state = modalState,
initialCategory = 0,
closeContentDescription = "",
onCloseClicked = { coroutineScope.launch { modalState.hide() } },
onDismiss = { /* handle dismiss */ },
onImageChanged = { /* Handle on image change if needed (ie logging) */ },
onCategoryChanged = { /* Handle on category change if needed (ie logging) */ },
onImageClicked = { /* Handle on image clicked if needed (ie logging) */ },
categories = listOf(
BpkImageGalleryImageCategory(
title = title,
images = listOf(
BpkImageGalleryImage(
title = "",
description = "",
credit = "",
content = { contentDescription, contentScale ->
// Image content
},
),
// more images
),
content = { /* Category image content */ },
),
// more categories
),
)
Made with ❤️ by Skyscanner © 2024
© 2024 Skyscanner Backpack. Page last updated on Jan 9, 2024, 14:09