NMButtonStyle Guide

August 28, 2024 ยท View on GitHub

Overview

NMButtonStyle is a custom ButtonStyle that applies a neumorphic design to any Button in SwiftUI. This style offers a modern, sleek look with distinctive shadows and smooth effects. This guide will help you integrate and customize NMButtonStyle in your SwiftUI applications.

Customize the Style

The NMButtonStyle initializer allows you to customize various aspects of the button. Below is a detailed table of available parameters:

ParameterDescriptionDefault Value
shapeThe shape to be used for the button's background.None
primaryColorThe primary color of the button.Color.Neumorphic.main
paddingThe padding around the button's content.30
darkColorThe color of the dark shadow.Color.Neumorphic.darkShadow
lightColorThe color of the light shadow.Color.Neumorphic.lightShadow
innerShadowOffsetThe offset of the inner shadow from the button's content.2
innerShadowBlurRadiusThe blur radius for the button's inner shadow.2
outerLightShadowOffsetThe offset of the light shadow from the button's background.3
outerDarkShadowOffsetThe offset of the dark shadow from the button's background.5
outerShadowRadiusThe blur radius for the button's outer shadows.4
innerShadowWidthThe width of the inner shadows.8