[tw5] Limiting tiddler width

Hello,

I’m using a single file default TW and want to make a minor adjustment to the theme.

I’d like to limit the size of the of my tiddlers when the sidebar is collapsed.

What would be the best way to go about this?

Thanks,
Brin

Create a tiddler (e.g., “SetTiddlerWidth”), tagged with $:/tags/Stylesheet, containing:

<$list filter="[{$:/state/sidebar}match[no]]">
.tc-tiddler-frame { width:50vw; min-width:600px; margin-left:auto; margin-right:auto; }
</$list>

Notes:

  • The contents of $:/state/sidebar are automatically set to “yes” or “no” when you click the double-chevron (“toggle sidebar”) button

  • The $list widget acts as a conditional test to check if the text field of $:/state/sidebar contains “no”.

  • width:50vw; limits the tc-tiddler-frame element to 50% of the current window width

  • min-width:600px; ensures that the width of the tiddler frames don’t get too small if the current window width is very narrow

  • margin-left:auto; and margin-right:auto; centers the tiddler frames within the window

enjoy,
-e

2 Likes