> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swiftcn.lol/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

<div style={{ display: "flex", justifyContent: "center" }}>
  <div style={{ marginRight: "40px" }}>
    <img src="https://www.swiftcn.lol/buttonLight.png" width="150" />

    <p>Button (light mode)</p>
  </div>

  <div>
    <img src="https://www.swiftcn.lol/buttonDark.png" width="150" />

    <p>Button (dark mode)</p>
  </div>
</div>

## Installation

Include the `CustomButton.swift` file in your SwiftUI project. [File Link](https://github.com/Swiftcn-UI/swiftcn-playground/blob/main/Swiftcn%20Playground.swiftpm/Components/CustomButton.swift)

## 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:

```swift theme={null}
CustomButton(action: {
    print("Button tapped!")
}, label: "Tap Me")
```
