4

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

Igor
  • 1,406
  • 2
  • 23
  • 45
Jeff F
  • 45
  • 5

2 Answers2

6

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

Rich Harris
  • 28,091
  • 3
  • 84
  • 99
  • 1
    Thanks Rich, I see it working [here](https://svelte.dev/repl/2b9e2423149741b7af35274094dbc109?version=3.6.7) but I'm not sure why the splitter if not visible or why the text on either side hidden as well. – Jeff F Jul 14 '19 at 21:54
  • 1
    I guess what we really need is SplitPane to be a component like svelte-subdivide is – Jeff F Jul 16 '19 at 02:52
1

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.

Aÿlo
  • 271
  • 3
  • 7