Components
Carousel
Horizontal paging banner carousel with auto-play, animated pill dot indicators, navigation arrows, hero gradient slides, and image gallery overlays
The UX4G Carousel suite provides production-ready horizontal paging banners with smooth spring animations, auto-play timers, and animated dot/capsule pagination:
- Hero Banner Carousel (
Ux4gHeroCarouselSlide): Vibrant multi-color gradient slide with category badge, bold headline, description, and white action button. - Image Gallery Carousel (
Ux4gImageCarouselSlide): Full-bleed photo slide with dark gradient overlay, category tag, headline, and subtitle. - Custom Content Carousel: Dynamic carousel accepting any custom composable slide builder with configurable heights and page transitions.
Import from com.ux4g.designsystemv1.components.Ux4gCarousel.
Interactive Previews
1. Hero Banner Carousel (Ux4gHeroCarouselSlide)
Ux4gCarousel - Hero Gradient BannersJetpack Compose

2. Image Gallery Carousel (Ux4gImageCarouselSlide)
Ux4gCarousel - Image Gallery with Dark OverlayJetpack Compose

Kotlin Usage
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.Ux4gCarousel
import com.ux4g.designsystemv1.components.Ux4gHeroCarouselSlide
import com.ux4g.designsystemv1.components.Ux4gImageCarouselSlide
@Composable
fun CarouselShowcaseScreen() {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(24.dp)
) {
// 1. Hero Gradient Banners Carousel
Ux4gCarousel(
height = 240.dp,
autoPlay = true,
autoPlayIntervalMs = 3000L,
showPagination = true,
showPaginationArrows = true,
items = listOf(
{
Ux4gHeroCarouselSlide(
gradientColors = listOf(Color(0xFFD97706), Color(0xFFE11D48)),
badgeText = "POPULAR",
title = "Unified Design System",
description = "Production-ready accessible UI components built for digital infrastructure.",
buttonText = "Get Started",
onButtonClick = { /* handle action */ }
)
},
{
Ux4gHeroCarouselSlide(
gradientColors = listOf(Color(0xFF4F46E5), Color(0xFF7C3AED)),
badgeText = "FEATURED",
title = "Digital Services Portal 2.0",
description = "Seamlessly access government citizen services with single sign-on and instant verification.",
buttonText = "Explore Services",
onButtonClick = { /* handle action */ }
)
}
)
)
// 2. Image Gallery Overlay Carousel
Ux4gCarousel(
height = 240.dp,
autoPlay = false,
items = listOf(
{
Ux4gImageCarouselSlide(
imageUrl = "https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=800&q=80",
badgeText = "NETWORK",
title = "Global Cloud Infrastructure",
subtitle = "High availability and low latency cross-region deployment."
)
},
{
Ux4gImageCarouselSlide(
imageUrl = "https://images.unsplash.com/photo-1579546929518-9e396f3cc809?auto=format&fit=crop&w=800&q=80",
badgeText = "DESIGN",
title = "Modern UI System Architecture",
subtitle = "Crafted with accessible design tokens & fluid responsive components."
)
}
)
)
}
}Parameters
1. Ux4gCarousel Props
| Prop | Type | Description | Default |
|---|---|---|---|
items * | List<@Composable () -> Unit> | List of composable slide items to render. | — |
modifier | Modifier | Compose layout modifier applied to the carousel root container. | Modifier |
autoPlay | Boolean | Whether the carousel automatically cycles through slide pages. | true |
autoPlayIntervalMs | Long | Time in milliseconds between automatic slide transitions. | 3000L |
showPagination | Boolean | Whether to display the dot pagination indicator at the bottom. | true |
showPaginationArrows | Boolean | Whether to show left/right arrow buttons alongside pagination dots. | true |
height | Dp | Fixed height of the carousel container. | 240.dp |
viewportFraction | Float | Fraction of the viewport each page should occupy (1.0f for full width). | 1.0f |
contentPadding | PaddingValues | Inner padding surrounding pages in viewport. | PaddingValues(0.dp) |
pageSpacing | Dp | Spacing between consecutive slide pages. | 0.dp |
activePaginationColor | Color | Fill color for the active elongated pill indicator. | Ux4gColors.primary |
inactivePaginationColor | Color | Fill color for inactive dot indicators. | Ux4gColors.primary100 |
paginationArrowBackgroundColor | Color | Circular background color for previous/next arrow buttons. | Color(0xFFDCD6FD) |
paginationArrowColor | Color | Icon tint color for navigation arrow chevrons. | Ux4gColors.primary |
paginationVariant | Ux4gPaginationVariant | Visual container style: Default (transparent) or Capsule (white pill). | Ux4gPaginationVariant.Default |
paginationSize | Ux4gPaginationSize | Sizing preset: Small or Medium. | Ux4gPaginationSize.Small |
onPageChange | ((Int) -> Unit)? | Callback triggered whenever the current active page index changes. | null |
2. Ux4gHeroCarouselSlide Props
| Prop | Type | Description | Default |
|---|---|---|---|
gradientColors * | List<Color> | Linear gradient color stops applied to background banner. | — |
badgeText * | String | Text displayed in top semi-transparent category badge. | — |
title * | String | Large headline text inside the banner. | — |
description * | String | Paragraph description text. | — |
buttonText * | String | Label for the white filled call-to-action button. | — |
modifier | Modifier | Compose layout modifier. | Modifier |
borderRadius | Dp | Corner rounding radius for slide boundary. | 16.dp |
onButtonClick | () -> Unit | Click listener callback for the action button. | {} |
3. Ux4gImageCarouselSlide Props
| Prop | Type | Description | Default |
|---|---|---|---|
imageUrl * | String | Remote URL or image asset path loaded via Coil. | — |
badgeText * | String | Text displayed inside the top-left dark tag badge. | — |
title * | String | Headline text overlaid on dark bottom gradient. | — |
subtitle * | String | Subtitle description text. | — |
modifier | Modifier | Compose layout modifier. | Modifier |
borderRadius | Dp | Corner rounding radius. | 16.dp |
Card
Versatile surface container supporting Vertical & Horizontal layouts, media banners with tags, headers with avatars, status chips, body text, bottom chips, and action button footers
Checkbox
Tri-state selection controls featuring custom sizes, helper/error/warning/success validation descriptions, required flags, and disabled states