Skip to content

Commit 790abe7

Browse files
committed
Add CornerRadius and RelativePadding
1 parent 835dd70 commit 790abe7

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

components/diagram/shapes.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Some Shape types provide unique behavior or settings:
137137
````
138138
* The `Terminator` Shape normally requires a `Width` that is larger than the `Height`.
139139
* The `Text` Shape has no borders and background. It occupies the minimum required amount of space to enclose the text content. To display text Shapes with some empty space around the content, use transparent Shapes of another type.
140+
* All shapes, except `Circle`, `Image`, `Rectangle`, and `Text` can display with rounded corners. See [`CornerRadius` in the Styling section](#styling).
140141
141142
>caption Using transparent Rectangle shapes instead of Text shapes
142143
@@ -215,21 +216,26 @@ The following Shape styling options are available in child tags of `<DiagramShap
215216
* Rotation angle
216217
* Border (stroke) color, type, width, and opacity
217218

219+
In addition to the above:
220+
221+
* `<DiagramShapeDefaults>` and `<DiagramShape>` have a `CornerRadius` parameter that rounds both the border and the background at the Shape corners. If you need a rectangle shape with rounded corners, then use the [`Process` Shape type](#shape-types) instead of `Rectangle`.
222+
* `<DiagramShapeDefaultsContent>` and `<DiagramShapeContent>` have a `RelativePadding` parameter that adds padding as a ratio of the Shape width. For example, `RelativePadding="0.1"` applies a 10% padding. In some cases, you can increase the padding to force the Shape text to wrap.
223+
218224
>caption Setting global and Shape-specific color styles
219225
220226
````RAZOR.skip-repl
221227
<TelerikDiagram>
222-
<DiagramShapeDefaults>
223-
<DiagramShapeDefaultsContent Color="white" FontSize="16" />
228+
<DiagramShapeDefaults CornerRadius="4">
229+
<DiagramShapeDefaultsContent Color="white" FontSize="16" RelativePadding="0.1" />
224230
<DiagramShapeDefaultsFill Color="purple" />
225231
<DiagramShapeDefaultsHover>
226232
<DiagramShapeDefaultsHoverFill Color="blue" />
227233
</DiagramShapeDefaultsHover>
228234
</DiagramShapeDefaults>
229235
230236
<DiagramShapes>
231-
<DiagramShape>
232-
<DiagramShapeContent Color="#3d3d3d" FontSize="24" />
237+
<DiagramShape CornerRadius="6">
238+
<DiagramShapeContent Color="#3d3d3d" FontSize="24" RelativePadding="0.2" />
233239
<DiagramShapeFill Color="#e0e0e0" />
234240
<DiagramShapeHover>
235241
<DiagramShapeHoverFill Color="#d6d6d6" />
@@ -324,13 +330,19 @@ The following configuration is not using a prefefined [Diagram layout](slug:diag
324330
</DiagramShapeConnectorDefaults>
325331
<DiagramShapeContent Text="Image" Color="#000" FontSize="20" FontWeight="bold" />
326332
</DiagramShape>
327-
<DiagramShape Height="80"
333+
<DiagramShape CornerRadius="6"
334+
Height="80"
328335
Id="shape3"
329-
Type="@DiagramShapeType.Rectangle"
336+
Type="@DiagramShapeType.Process"
330337
Width="160"
331338
X="350"
332339
Y="50">
333-
<DiagramShapeContent Text="Rectangle" Color="#3d3d3d" FontSize="18" FontWeight="bold" FontStyle="italic" />
340+
<DiagramShapeContent Color="#3d3d3d"
341+
FontSize="18"
342+
FontStyle="italic"
343+
FontWeight="bold"
344+
RelativePadding="0.1"
345+
Text="Rounded Process" />
334346
<DiagramShapeFill Color="#e0e0e0" />
335347
<DiagramShapeHover>
336348
<DiagramShapeHoverFill Color="#d6d6d6" />

0 commit comments

Comments
 (0)