Neumorphic Button Template

Achieve the trendy "soft UI" look with this elegant and minimalist neumorphic button.

This design uses matching light and dark shadows to create the illusion that the button is extruded from the same material as the background, a hallmark of neumorphism.

Screenshot of a button with a soft, neumorphic design.

Get Source Code Preview

About the Neumorphic Button

Neumorphism is a design style that aims to create a soft, light, and almost "unibody" look for user interfaces. Instead of floating on a different layer like in Material Design, neumorphic elements appear to be connected to the background. This template achieves the effect with a careful combination of two shadows and a background color that matches its container.

Features

Code Breakdown

The key to this component is the box-shadow property, which is given two comma-separated values. The first value creates a light-colored shadow offset to the top-left, and the second creates a dark-colored shadow offset to the bottom-right. The button's background color must be identical to the parent container's background for the illusion to work. In the :active state, the box-shadow values are prefixed with the inset keyword, which draws the shadows inside the button's frame, making it appear pressed.

Code

Here is the complete code for the neumorphic button.

View Output