Coder Social home page Coder Social logo

saibotsivad / svelte-sidebar-panels Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 224 KB

Left and right side panel navigational menu component.

Home Page: https://saibotsivad.github.io/svelte-sidebar-panels/

License: Other

JavaScript 5.18% Svelte 94.82%
svelte

svelte-sidebar-panels's Introduction

Svelte Sidebar Panels

Svelte component for the classic two/three-column website layout, where the left and right columns can be toggled.

Have a look at the demo, or look at the demo code. (Be sure to check the demo on a mobile device, or in your browser in mobile mode.)

Install

The usual way:

npm install svelte-sidebar-panels

Use

There are three slots: the main content area, and the left and right columns. (You don't need the left or right columns, e.g. if you want only the left column.)

The component emits an event named change which tells you when the panels change state, and you bind to updatePanels as a function to manually toggle the panels (e.g. from a nav menu).

For example, using only the left panel (view in REPL):

<script>
	import SidebarPanels from 'svelte-sidebar-panels'
	let updatePanels
	let leftOpen
</script>
<SidebarPanels
	bind:updatePanels
	on:change={ (event) => leftOpen = event.detail.left }
>
	<div slot="left">
		left panel
	</div>
	<div slot="content">
		main content
		<button on:click={ () => updatePanels({ left: !leftOpen }) }>
			toggle left panel
		</button>
	</div>
</SidebarPanels>

For more details, have a look at the documentation for each configurable property.

License

This project published and released under the Very Open License

svelte-sidebar-panels's People

Contributors

saibotsivad avatar github-actions[bot] avatar

Stargazers

Aleš Veselý avatar Michael Keller avatar Lucas Rodrigues dos Santos avatar Alex Front avatar Fabien Franzen avatar Nick Reese avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

dabugger

svelte-sidebar-panels's Issues

Svelte-Sidebar-Panels Advanced Example

I was looking for a more complex example, and found the svelte-sidebar-panels/src/demo/Demo.svelte. I put it up in a REPL.

I am still looking for....

  1. Changing left and right panel widths
  2. Removing the dead space between left/content/right. It looks like this is a spacer for possible scrollbars. Can it be changed to show only if needed (overflow-y: auto)

image

  1. Feature request. Instead of fully collapsing and requiring event triggers in main content area, I would like an option for a collapsed panel leaving a small/width configurable exposed edge on the screen where a mouseover auto-expands, mouseout auto-collapses. Obviously, an option for both left and right

  2. Feature request. To round it out, support top and bottom panels too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.