{"id":15064401,"url":"https://github.com/collardeau/svelte-fluid-header","last_synced_at":"2025-04-10T11:52:51.265Z","repository":{"id":57375214,"uuid":"212985175","full_name":"collardeau/svelte-fluid-header","owner":"collardeau","description":"A responsive and customizable header component for Svelte","archived":false,"fork":false,"pushed_at":"2019-10-11T14:20:21.000Z","size":80,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T14:43:51.070Z","etag":null,"topics":["responsive-design","svelte","svelte-component"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/collardeau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-05T11:03:19.000Z","updated_at":"2023-01-03T18:32:26.000Z","dependencies_parsed_at":"2022-09-05T14:11:25.573Z","dependency_job_id":null,"html_url":"https://github.com/collardeau/svelte-fluid-header","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collardeau%2Fsvelte-fluid-header","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collardeau%2Fsvelte-fluid-header/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collardeau%2Fsvelte-fluid-header/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/collardeau%2Fsvelte-fluid-header/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/collardeau","download_url":"https://codeload.github.com/collardeau/svelte-fluid-header/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215192,"owners_count":21066622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["responsive-design","svelte","svelte-component"],"created_at":"2024-09-25T00:17:18.027Z","updated_at":"2025-04-10T11:52:51.248Z","avatar_url":"https://github.com/collardeau.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-fluid-header\n\n`svelte-fluid-header` is a **responsive** and **customizable** header component for [Svelte](https://svelte.dev/).\n\nOn **large screens**, use a horizontal menu inside your header. On **small screens**, move the menu to a drawer below.\n\n![](http://g.recordit.co/StDfeVYJRp.gif)\n\n`svelte-fluid-header` has **no production dependencies**.\n\n# Demo\n\n[Example](https://xuyfx.csb.app/) |  [Code Sandbox](https://codesandbox.io/s/svelte-fluid-header-demo-xuyfx?view=preview)\n\n## Install\n\n`npm install svelte-fluid-header`\n\n## Usage\n\n```html\n\u003cscript\u003e\n  import Fluid from \"svelte-fluid-header\"\n\u003c/script\u003e\n\n\u003cheader\u003e\n  \u003cFluid\u003e\n    \u003cdiv slot=\"left\"\u003e\n      My Header Title\n    \u003c/div\u003e\n    \u003cdiv slot=\"right\"\u003e\n      My Horizontal Menu\n    \u003c/div\u003e\n     \u003cdiv slot=\"drawer\"\u003e\n       My Vertical Menu\n     \u003c/div\u003e\n  \u003c/Fluid\u003e\n\u003c/head\n\n```\n\nMake sure to wrap your `\u003cFluid\u003e ` component in another HTML tag (as in the `\u003cheader\u003e` in the example above).\n\n## Slots\n\n#### `left`\n\nThe `left` slot goes into the left side of the header, usually for a logo and/or page title.\n\n#### `right`\n\nThe `right` slot goes into the right side of the header, usually for a horizontal menu.\n\n*It is hidden on smaller screens.*\n\n#### `drawer`\n\nThe `drawer` slot goes below the header, usually to place a vertical menu. It can be toggled into view (with a customizable slide animation).\n\n*It is hidden on larger screens.*\n\n#### `right-collapsed` optional\n\nThe `right-collapsed` slot goes to the right of the header on smaller screens, usually for a hamburger button to reveal the drawer.\n\nIt is optional as `svelte-fluid-header` provides a default slot (including hamburger and close buttons, which may be styled). See the Binding section below to create a custom button.\n\n*`right-collapsed` is hidden on larger screens.*\n\n## Props\n\n#### `breakpoint`\n\nThe breakpoint at which the `right` slot is displayed, and the `right-collapsed` and `drawer` slots are hidden.\nPossible values are:\n - `sm` (640px)\n - `md`(768px),\n - `lg`(1024px),\n - `xl`(1200px).\n \n The default value is `sm`.\n\n#### `duration`\n\nThe duration of the drawer slider animation in milliseconds.\nThe default is `200`.\n\n## Styling\n\nSlots give you control of your content and your style.\n\nTo style the default button, you can hook into the `svelte-fluid-header--button` class;\n\n```html\n\u003cstyle\u003e\n  :global(.svelte-fluid-header--button) {\n    color: grey\n  }\n\u003c/style\u003e\n```\nA few CSS properties such as `background-color` will need an `!important` flag.\n\n## Binding\n\nYou can bind to the `toggleDrawer` function of your `svelte-fluid-header` component. This is especially handy if you implement your own toggle button:\n\n```html\n\u003cscript\u003e\n  let toggleDrawer; // from bind below\n  const handleClick = () =\u003e {\n    toggleDrawer();\n  };\n\u003c/script\u003e\n\n\u003cFluid bind:toggleDrawer\u003e\n  \u003c!-- other slots --\u003e\n  \u003cdiv slot=\"right-collapsed\"\u003e\n    \u003cbutton on:click={handleClick}\u003eToggle\u003c/button\u003e\n  \u003c/div\u003e\n\u003c/Fluid\u003e\n\n```\n\n## Events\n\nTwo events are emitted from the component when the drawer is toggled, `open` and `close`:\n\n```html\n\u003cFluid\n  on:open={() =\u003e {\n    console.log('drawer will open');\n  }}\n  \u003cFluidHeader\n  on:close={() =\u003e {\n    console.log('drawer will close');\n  }}\n  \u003c!-- slots --\u003e\n\u003c/Fluid\u003e\n\n```\n\n## Kitchen Sink\n\nAll the options available:\n\n```html\n\u003cscript\u003e\n  import Fluid from 'svelte-fluid-header';\n  let toggleDrawer;\n  const handleClick = () =\u003e {\n    toggleDrawer();\n  };\n\u003c/script\u003e\n\n\u003cstyle\u003e\n  :global(.svelte-fluid-header--button) {\n    color: grey\n  }\n  :global(.svelte-fluid-header--button:hover) {\n    color: grey\n  }\n\u003c/style\u003e\n\n\u003cheader\u003e\n  \u003cFluidHeader\n    breakpoint='md'\n    duration={250}\n    bind:toggleDrawer\n    on:open={ () =\u003e {} }\n    on:close={ ()=\u003e {} }\u003e\n    \u003cdiv slot=\"left\"\u003e\u003ch1\u003eMy app\u003c/h1\u003e\u003c/div\u003e\n    \u003cdiv slot=\"right\"\u003eMy Horizontal Menu\u003c/div\u003e\n    \u003cdiv slot=\"drawer\"\u003eMy Vertical Menu\u003c/div\u003e\n    \u003cdiv slot=\"right-collapsed\"\u003e\n      \u003cbutton on:click={handleClick}\u003eToggle\u003c/button\u003e\n    \u003c/div\u003e\n  \u003c/FluidHeader\u003e\n\u003c/header\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcollardeau%2Fsvelte-fluid-header","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcollardeau%2Fsvelte-fluid-header","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcollardeau%2Fsvelte-fluid-header/lists"}