Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Svelte splitter example

I'm looking for a svelte way to adjust the size of a div on a page.

there's an example here.

I have not found any examples specifically but I'm sure someone has solved this.

Thanks

like image 673
Jeff F Avatar asked Oct 21 '25 12:10

Jeff F


2 Answers

There's a <SplitPane> component used inside Svelte's own REPL — example usage: https://github.com/sveltejs/svelte-repl/blob/d6a99e702d42eb18142dccbd6b766b56b69245e4/src/Repl.svelte#L208-L221

like image 111
Rich Harris Avatar answered Oct 23 '25 07:10

Rich Harris


Here a quick implementation of a split pane in svelte, no external library : https://svelte.dev/repl/b467a4787de3487fbe5c4508e8221268?version=3.42.1

It lets you to chose the minimum width of the panes, and it prevents automatic highlighting of the text in the panes while dragging the splitter.

The component logic is quite simple, so you can change it and adapt it to your project.

like image 26
Aÿlo Avatar answered Oct 23 '25 09:10

Aÿlo