Jeff F
Jeff F

Reputation: 55

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

Upvotes: 4

Views: 1945

Answers (2)

Aÿlo
Aÿlo

Reputation: 311

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.

Upvotes: 1

Rich Harris
Rich Harris

Reputation: 29615

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

Upvotes: 6

Related Questions