Reputation: 120
I have a React project with TypeScript. I'm using the react-konva package to draw some shapes.
How can I add to my shape a border like at HTML (border: 1px solid black
)?
My code:
<Rect
x={103}
y={103}
width={144}
height={44}
// here i need a border
fill="#E2E6EA"
draggable
onDragStart={this.handleDragStart}
onDragEnd={this.handleDragEnd}
/>
Upvotes: 2
Views: 5028
Reputation:
You have to set the border using strokeWidth
& stroke
attributes.
<Rect
x={103}
y={103}
width={144}
height={44}
// here i need a border
fill="#E2E6EA"
draggable
onDragStart={this.handleDragStart}
onDragEnd={this.handleDragEnd}
strokeWidth={1} // border width
stroke="red" // border color
/>
Upvotes: 8