Search code examples
draw.io

Change style of individual borders of a rectangle in draw.io


I want to format a rectangle in draw.io, such that only one border (left border) is colored black, the other borders: top, right and bottom must remain "clear".

I am trying to figure out proper coding to affect only those elements, but it seems that you can affect only the entire border with the style key: imageBorder=none as explained in shape styles for Draw.io

Is there a way to only have one border with a specific color, and the other borders blank? Code for such a trick would be very welcome.


Solution

  • When you type "rectangle" in the Search bar, you will see "Partial rectangle" which sounds like the one you are looking for. Also, there is a possibility to change some properties in the Format panel on the right when a shape is selected.

    You can also add the following style:

    verticalLabelPosition=bottom;
    verticalAlign=top;
    html=1;
    shape=mxgraph.basic.rect;
    fillColor=#ffffff;
    fillColor2=none;
    strokeColor=#000000;
    strokeWidth=1;
    size=20;
    indent=5;
    

    in the Edit style window, and then play with the extended list of properties in the Format panel.