⚠️ Early Stage Project: This library is not production-ready yet. Developers should use it with caution and expect breaking changes.

Lines

Draw lines and paths connecting coordinates on the map.

Installation

First, make sure you have the base map component installed:

npx shadcn@latest add https://terrae.vercel.app/maps/map.json

Then install the line component:

npx shadcn@latest add https://terrae.vercel.app/maps/map-line.json

Basic Line

Draw a simple line connecting a series of coordinates.

Markers

Combine lines with markers to show stops or waypoints along the path.

Real-Time Routes with OSRM

Display real-world routes calculated by OSRM (Open Source Routing Machine). This example fetches the optimized route between waypoints and displays it on the map.

Loading route...

Line Colors

Customize line colors using the color prop. Choose from any color value to match your design or data visualization needs.

Color
#3b82f6

Line Width

Adjust the thickness of your lines using the width prop. Values are in pixels and can range from thin (1px) to thick (15px or more).

Width
4px

Line Opacity

Control line transparency with the opacity prop. Values range from 0 (transparent) to 1 (fully opaque).

Opacity
100%

Dash Patterns

Control the dash length in dashed lines using the dashArray prop. The first value determines the length of each dash segment.

Pattern
Short Dash
Dash Array
[4, 2]

Gap Spacing

Adjust the spacing between dashes using the gap value in the dashArray prop. The second value controls the space between each dash.

Spacing
Tight
Dash Array
[4, 2]