Limiting tiddler width

14 views
Skip to first unread message

Brin Zvan

unread,
Sep 23, 2022, 11:57:39 AM9/23/22
to TiddlyWiki
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

Eric Shulman

unread,
Sep 23, 2022, 12:20:50 PM9/23/22
to TiddlyWiki
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
Reply all
Reply to author
Forward
0 new messages