Rectangle
import {Rectangle} from 'cx/svg';Rectangle is a Cx version of SVG rect object which can be used in responsive scenarios.
<Svg style="width:400px;height:400px;background:white" padding={5}>
<Rectangle anchors="0 .25 .25 0" margin={5} colorIndex={0} rx={5} />
<Rectangle anchors="0 .5 .25 .25" margin={5} colorIndex={1} ry="5%" />
<Rectangle anchors="0 .75 .25 .5" margin={5} colorIndex={2} rx="9px" ry="25" />
<Rectangle anchors="0 1 .25 .75" margin={5} colorIndex={3} rx="3em"/>
<Rectangle anchors=".25 .25 .5 0" margin={5} colorIndex={7} />
<Rectangle anchors=".25 .5 .5 .25" margin={5} colorIndex={6} />
<Rectangle anchors=".25 .75 .5 .5" margin={5} colorIndex={5} />
<Rectangle anchors=".25 1 .5 .75" margin={5} colorIndex={4} />
<Rectangle anchors=".5 .25 .75 0" margin={5} colorIndex={8} />
<Rectangle anchors=".5 .5 .75 .25" margin={5} colorIndex={9} />
<Rectangle anchors=".5 .75 .75 .5" margin={5} colorIndex={10} />
<Rectangle anchors=".5 1 .75 .75" margin={5} colorIndex={11} />
<Rectangle anchors=".75 .25 1 0" margin={5} colorIndex={15} />
<Rectangle anchors=".75 .5 1 .25" margin={5} colorIndex={14} />
<Rectangle anchors=".75 .75 1 .5" margin={5} colorIndex={13} />
<Rectangle anchors=".75 1 1 .75" margin={5} colorIndex={12} />
</Svg>| Property | Description | Type |
|---|---|---|
fill | A color used to paint the box. | string |
rx | The horizontal corner radius of the rect. Defaults to | string/number |
ry | The vertical corner radius of the rect. Defaults to | string/number |
stroke | A color used to paint the outline of the box. | string |
anchors | Anchor defines how child bounds are tied to the parent. Zero aligns with the top/left edge. One aligns with the bottom/right edge. See Svg for more information. | string/number/rect |
class | Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list. | string/object |
colorIndex | Index of the color in the default color palette. Setting this property will set both fill and stroke on the
object.
Use | number |
items | List of child elements. | array |
margin | Apply margin to the given boundaries. See Svg for more information. | string/number/rect |
mod | Appearance modifier. For example, | string/array |
offset | Move boundaries specified by the offset. See Svg for more information. | string/number/rect |
outerLayout | Defines the outer layout which wraps the widget. | widget |
padding | Padding to be applied to the boundaries rectangle before passing to the children. | string/number/rect |
plainText | Set to | boolean |
preserveWhitespace | Keep whitespace in text based children. Default is | boolean |
putInto | Used with outer layouts. Specifies the name of the content placeholder which should render the widget. | string |
style | Style object applied to the wrapper div. Used for setting the dimensions of the element. | string/object |
trimWhitespace | Remove all whitespace in text based children. Default is | boolean |
vdomKey | Key that will be used as the key when rendering the React component. | string |
visible | Visibility of the widget. Defaults to | boolean |