doctorcard
OCDivider - A Customizable Divider for Composable UI
Add horizontal or vertical dividers to Jetpack Compose UI with customizable attributes.
Features
Customizable Divider Attributes: Define the width, height, padding, and color of the divider. Default Attributes: For quick usage, default attributes are provided based on the type of divider. Use the DividerType sealed class to easily choose between horizontal and vertical dividers.
- Create the Divider: Using the OCDivider function, create a divider and specify its type:
OCDivider( type = DividerType.Horizontal )
- Custom Attributes: Provide custom attributes using the DividerAttributes data class:
val customAttributes = DividerAttributes( height = 4.dp, width = 200.dp, padding = 16.dp, color = Color.Red )
OCDivider( type = DividerType.Vertical, attributes = customAttributes )
3. Using Default Attributes:
If no attributes are provided, the divider will use default values based on its type:
Horizontal: DividerType.Horizontal Vertical: DividerType.Vertical Attributes:
height: The height of the divider in Dp. width: The width of the divider in Dp. padding: The padding applied to the divider, specific to its type (horizontal or vertical). color: The color of the divider.