{"id":18536313,"url":"https://github.com/boltuix/compose-gradient-buttons","last_synced_at":"2026-04-26T20:31:57.387Z","repository":{"id":49833230,"uuid":"517365145","full_name":"BoltUIX/Compose-Gradient-Buttons","owner":"BoltUIX","description":"How to create Gradient Buttons in Jetpack Compose","archived":false,"fork":false,"pushed_at":"2022-07-27T06:20:05.000Z","size":216,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T02:13:05.609Z","etag":null,"topics":["android","button","customshape","gradient","jetpack-android","jetpack-compose","jetpackcompose","material-design","material3","shapes"],"latest_commit_sha":null,"homepage":"https://www.boltuix.com/2022/07/gradient-button-shapes-in-jetpack.html","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BoltUIX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-24T15:40:14.000Z","updated_at":"2025-04-09T06:54:46.000Z","dependencies_parsed_at":"2022-08-28T21:00:50.922Z","dependency_job_id":null,"html_url":"https://github.com/BoltUIX/Compose-Gradient-Buttons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BoltUIX/Compose-Gradient-Buttons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoltUIX%2FCompose-Gradient-Buttons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoltUIX%2FCompose-Gradient-Buttons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoltUIX%2FCompose-Gradient-Buttons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoltUIX%2FCompose-Gradient-Buttons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BoltUIX","download_url":"https://codeload.github.com/BoltUIX/Compose-Gradient-Buttons/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoltUIX%2FCompose-Gradient-Buttons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32312235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","button","customshape","gradient","jetpack-android","jetpack-compose","jetpackcompose","material-design","material3","shapes"],"created_at":"2024-11-06T19:31:55.859Z","updated_at":"2026-04-26T20:31:57.382Z","avatar_url":"https://github.com/BoltUIX.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compose-Gradient-Buttons\n\n![GitHub](https://img.shields.io/badge/Jetpack%20Compose-Gradient%20Buttons-blue?style=for-the-badge\u0026logo=android)\n\nHow to create Gradient Buttons with various shapes and styles in Jetpack Compose.\n\n## Preview\n![Compose Gradient Button](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw3-0XeY2Mjrm2TP_q42e1tmnsx_gtyPfN1JNJcReHndopV5E__DxdNG1IWMTlRgfGiqol7YcOFfyHplxTHQ2RdMpkjoXffdqchLtD5uWktrIgbmMiewlaQpOuaB-6iAUNAc91P9kS880NvEI2-9whFzpAIGhNlCDYnxstZS7zbGV9ZKsiO4b5AQul/s16000/button.jpg)\n\n## Features\n- **Gradient Button Styles**:\n  - Top Start\n  - Top End\n  - Bottom Start\n  - Bottom End\n  - Top Start \u0026 Bottom End\n  - Top End \u0026 Bottom Start\n  - All Sides\n  - Disabled Button\n  - No Ripple Effect\n- Built with Jetpack Compose for modern Android UI\n- Customizable corner radius and gradient colors\n\n## Implementation\nCreate a Kotlin file named `GradientButton.kt` and add the following code to implement the gradient buttons:\n\n```kotlin\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation.interaction.MutableInteractionSource\nimport androidx.compose.foundation.layout.Box\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.material3.Button\nimport androidx.compose.material3.ButtonDefaults\nimport androidx.compose.material3.Text\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.remember\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Brush\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.unit.Dp\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport androidx.compose.ui.graphics.RectangleShape\nimport androidx.compose.ui.graphics.Shape\nimport androidx.compose.foundation.shape.RoundedCornerShape\n\n@Composable\nfun GradientButton(\n    gradientColors: List\u003cColor\u003e,\n    cornerRadius: Dp,\n    nameButton: String,\n    roundedCornerShape: Shape,\n    isEnabled: Boolean = true,\n    hasRipple: Boolean = true\n) {\n    Button(\n        modifier = Modifier\n            .fillMaxWidth()\n            .padding(start = 32.dp, end = 32.dp),\n        onClick = { /* Your click action */ },\n        contentPadding = PaddingValues(),\n        colors = ButtonDefaults.buttonColors(\n            containerColor = Color.Transparent,\n            disabledContainerColor = Color.Gray\n        ),\n        shape = roundedCornerShape,\n        enabled = isEnabled,\n        interactionSource = if (!hasRipple) remember { MutableInteractionSource() } else null\n    ) {\n        Box(\n            modifier = Modifier\n                .fillMaxWidth()\n                .background(\n                    brush = Brush.linearGradient(colors = gradientColors),\n                    shape = roundedCornerShape\n                )\n                .padding(horizontal = 16.dp, vertical = 8.dp),\n            contentAlignment = Alignment.Center\n        ) {\n            Text(\n                text = nameButton,\n                fontSize = 20.sp,\n                color = Color.White\n            )\n        }\n    }\n}\n```\n\n### Usage\nTo use the gradient buttons in your project, call the `GradientButton` composable with different configurations:\n\n```kotlin\nval cornerRadius = 16.dp\nval gradientColors = listOf(Color(0xFFff00cc), Color(0xFF333399))\n\n// Top Start\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: Top Start\",\n    roundedCornerShape = RoundedCornerShape(topStart = 30.dp)\n)\n\n// Top End\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: Top End\",\n    roundedCornerShape = RoundedCornerShape(topEnd = 30.dp)\n)\n\n// Bottom Start\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: Bottom Start\",\n    roundedCornerShape = RoundedCornerShape(bottomStart = 30.dp)\n)\n\n// Bottom End\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: Bottom End\",\n    roundedCornerShape = RoundedCornerShape(bottomEnd = 30.dp)\n)\n\n// Top Start \u0026 Bottom End\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: Top Start \u0026 Bottom End\",\n    roundedCornerShape = RoundedCornerShape(topStart = 30.dp, bottomEnd = 30.dp)\n)\n\n// Top End \u0026 Bottom Start\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: Top End \u0026 Bottom Start\",\n    roundedCornerShape = RoundedCornerShape(topEnd = 30.dp, bottomStart = 30.dp)\n)\n\n// All Sides\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Style: All Sides\",\n    roundedCornerShape = RoundedCornerShape(cornerRadius)\n)\n\n// Disabled Button\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"Disabled Button\",\n    roundedCornerShape = RoundedCornerShape(cornerRadius),\n    isEnabled = false\n)\n\n// No Ripple Effect\nGradientButton(\n    gradientColors = gradientColors,\n    cornerRadius = cornerRadius,\n    nameButton = \"No Ripple\",\n    roundedCornerShape = RoundedCornerShape(cornerRadius),\n    hasRipple = false\n)\n```\n\n## Resources\n- [BoltUiX Gradient Button Tutorial](https://www.boltuix.com/2022/07/gradient-button-shapes-in-jetpack.html)\n- [Handpicked Color Gradients](https://www.boltuix.com/2022/07/gradient-colors.html)\n\n## Contributing\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboltuix%2Fcompose-gradient-buttons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboltuix%2Fcompose-gradient-buttons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboltuix%2Fcompose-gradient-buttons/lists"}