Components
Button
CustomButton in SwiftUI
Overview
CustomButton
is a SwiftUI component for creating a button with a custom style. It provides customization for the button’s action and label while adapting to the current color scheme.
Preview
Button (light mode)
Button (dark mode)
Installation
Include the CustomButton.swift
file in your SwiftUI project. File Link
Properties
action: () -> Void
(Required) - The closure that gets called when the button is tapped.label: String
(Required) - The label displayed on the button.
Note:
fontWeight
is internally set to.medium
as a default, and the color scheme is automatically detected.
Usage
Basic Usage
Here’s how you can use the CustomButton
component: