SwiftUI.js
Components

MeshGradient

MeshGradient adapts SwiftUI's mesh gradient concept into a layered CSS radial-gradient surface for the web.

MeshGradient adapts SwiftUI's mesh gradient concept into a layered CSS radial-gradient surface for the web.

Examples

Basic Usage

Preview unavailable for this example in the static docs build.

Show code
<MeshGradient width={320} height={200} colors={['#ff375f', '#5e5ce6', '#30d158', '#ffd60a']} points={[
      [0.15, 0.2],
      [0.8, 0.25],
      [0.35, 0.82],
      [0.82, 0.75],
    ]} style={{
      borderRadius: '24px',
    }}></MeshGradient>

API

PropTypeRequiredDescription
colorsstring[]YesNo description yet.
heightnumberYesNo description yet.
pointsArray<[number, number]>YesNo description yet.
widthnumberYesNo description yet.

Inherits additional props from IBaseComponent.

Overview

MeshGradient adapts SwiftUI's mesh gradient concept into a layered CSS radial-gradient surface for the web.

Status: adapted

SwiftUI Correspondence: Adapted from SwiftUI's MeshGradient.

Notes

  • points are normalized coordinates from 0 to 1
  • each color maps to the point at the same index
  • this adaptation favors static visual fidelity over editable mesh handles

On this page