{"id":18187763,"url":"https://github.com/polymerelements/iron-overlay-behavior","last_synced_at":"2025-08-22T18:32:34.980Z","repository":{"id":31202112,"uuid":"34762920","full_name":"PolymerElements/iron-overlay-behavior","owner":"PolymerElements","description":"Makes an element an overlay with an optional backdrop","archived":false,"fork":false,"pushed_at":"2023-10-16T14:02:50.000Z","size":1073,"stargazers_count":41,"open_issues_count":27,"forks_count":71,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-12-15T08:32:16.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/PolymerElements.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-29T00:18:57.000Z","updated_at":"2023-09-05T11:25:06.000Z","dependencies_parsed_at":"2024-06-18T12:42:26.712Z","dependency_job_id":"91dec57a-77e7-472c-a01f-added8b24e96","html_url":"https://github.com/PolymerElements/iron-overlay-behavior","commit_stats":{"total_commits":289,"total_committers":35,"mean_commits":8.257142857142858,"dds":0.6055363321799307,"last_synced_commit":"97af5e9bd3eed88efcfef51ea0f8b1b0bf545185"},"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-overlay-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-overlay-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-overlay-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolymerElements%2Firon-overlay-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolymerElements","download_url":"https://codeload.github.com/PolymerElements/iron-overlay-behavior/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230626697,"owners_count":18255685,"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":[],"created_at":"2024-11-03T02:03:14.101Z","updated_at":"2024-12-20T18:11:02.161Z","avatar_url":"https://github.com/PolymerElements.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Published on NPM](https://img.shields.io/npm/v/@polymer/iron-overlay-behavior.svg)](https://www.npmjs.com/package/@polymer/iron-overlay-behavior)\n[![Build status](https://travis-ci.org/PolymerElements/iron-overlay-behavior.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-overlay-behavior)\n[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://webcomponents.org/element/@polymer/iron-overlay-behavior)\n\n## IronOverlayBehavior\n\nUse `IronOverlayBehavior` to implement an element that can be hidden or shown, and displays\non top of other content. It includes an optional backdrop, and can be used to implement a variety\nof UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.\n\nSee the [demo source code](https://github.com/PolymerElements/iron-overlay-behavior/blob/master/demo/simple-overlay.js)\nfor an example.\n\n### Closing and canceling\n\nAn overlay may be hidden by closing or canceling. The difference between close and cancel is user\nintent. Closing generally implies that the user acknowledged the content on the overlay. By default,\nit will cancel whenever the user taps outside it or presses the escape key. This behavior is\nconfigurable with the `no-cancel-on-esc-key` and the `no-cancel-on-outside-click` properties.\n`close()` should be called explicitly by the implementer when the user interacts with a control\nin the overlay element. When the dialog is canceled, the overlay fires an 'iron-overlay-canceled'\nevent. Call `preventDefault` on this event to prevent the overlay from closing.\n\n### Positioning\n\nBy default the element is sized and positioned to fit and centered inside the window. You can\nposition and size it manually using CSS. See `Polymer.IronFitBehavior`.\n\n### Backdrop\n\nSet the `with-backdrop` attribute to display a backdrop behind the overlay. The backdrop is\nappended to `\u003cbody\u003e` and is of type `\u003ciron-overlay-backdrop\u003e`. See its doc page for styling\noptions.\n\nIn addition, `with-backdrop` will wrap the focus within the content in the light DOM.\nOverride the [`_focusableNodes` getter](#Polymer.IronOverlayBehavior:property-_focusableNodes)\nto achieve a different behavior. Additionally, you can add the `iron-focusable` attribute to\nany element in the light DOM to mark it as focusable.\n\n### Limitations\n\nThe element is styled to appear on top of other content by setting its `z-index` property. You\nmust ensure no element has a stacking context with a higher `z-index` than its parent stacking\ncontext. You should place this element as a child of `\u003cbody\u003e` whenever possible.\n\n## \u0026lt;iron-overlay-backdrop\u0026gt;\n\n`iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It should be a\nsingleton.\n\n### Styling\n\nThe following custom properties and mixins are available for styling.\n\n| Custom property | Description | Default |\n| --- | --- | --- |\n| `--iron-overlay-backdrop-background-color` | Backdrop background color | #000 |\n| `--iron-overlay-backdrop-opacity` | Backdrop opacity | 0.6 |\n| `--iron-overlay-backdrop` | Mixin applied to `iron-overlay-backdrop`. | {} |\n| `--iron-overlay-backdrop-opened` | Mixin applied to `iron-overlay-backdrop` when it is displayed | {} |\n\nSee: [Documentation](https://www.webcomponents.org/element/@polymer/iron-overlay-behavior),\n  [Demo](https://www.webcomponents.org/element/@polymer/iron-overlay-behavior/demo/demo/index.html).\n\n## Usage\n\n### Installation\n```\nnpm install --save @polymer/iron-overlay-behavior\n```\n\n### In a Polymer 3 element\n```js\nimport {PolymerElement, html} from '@polymer/polymer';\nimport {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';\nimport {IronOverlayBehavior} from '@polymer/iron-overlay-behavior/iron-overlay-behavior.js';\n\nclass SampleElement extends mixinBehaviors(IronOverlayBehavior, PolymerElement) {\n  static get template() {\n    return html`\n      \u003cstyle\u003e\n        :host {\n          background: white;\n        }\n      \u003c/style\u003e\n      \u003cp\u003eOverlay Content\u003c/p\u003e\n    `;\n  }\n}\ncustomElements.define('sample-element', SampleElement);\n```\n\n## Contributing\nIf you want to send a PR to this element, here are\nthe instructions for running the tests and demo locally:\n\n### Installation\n```sh\ngit clone https://github.com/PolymerElements/iron-overlay-behavior\ncd iron-overlay-behavior\nnpm install\nnpm install -g polymer-cli\n```\n\n### Running the demo locally\n```sh\npolymer serve --npm\nopen http://127.0.0.1:\u003cport\u003e/demo/\n```\n\n### Running the tests\n```sh\npolymer test --npm\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolymerelements%2Firon-overlay-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolymerelements%2Firon-overlay-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolymerelements%2Firon-overlay-behavior/lists"}