{"id":16384646,"url":"https://github.com/nerdic-coder/stencil-container","last_synced_at":"2026-05-04T10:37:08.947Z","repository":{"id":57370732,"uuid":"133846566","full_name":"nerdic-coder/stencil-container","owner":"nerdic-coder","description":"A stencil component that displays child element if all conditions are fulfilled.","archived":false,"fork":false,"pushed_at":"2018-05-27T20:13:20.000Z","size":72,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T10:05:01.644Z","etag":null,"topics":["javascript","jsx","stencil","stencil-components","stencil-js","stenciljs","stenciljs-components","typescript","webcomponent","webcomponents"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nerdic-coder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-17T17:24:00.000Z","updated_at":"2018-05-27T20:09:53.000Z","dependencies_parsed_at":"2022-09-18T10:30:35.460Z","dependency_job_id":null,"html_url":"https://github.com/nerdic-coder/stencil-container","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdic-coder%2Fstencil-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdic-coder%2Fstencil-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdic-coder%2Fstencil-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdic-coder%2Fstencil-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nerdic-coder","download_url":"https://codeload.github.com/nerdic-coder/stencil-container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240114328,"owners_count":19749838,"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":["javascript","jsx","stencil","stencil-components","stencil-js","stenciljs","stenciljs-components","typescript","webcomponent","webcomponents"],"created_at":"2024-10-11T04:12:01.956Z","updated_at":"2026-05-04T10:37:03.926Z","avatar_url":"https://github.com/nerdic-coder.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stencil Container\nA stencil component that displays child elements with conditional data.\n\n## Using this component\n\n### Script tag\n\n- Put `\u003cscript src='https://unpkg.com/stencil-container@latest/dist/stencil-container.js'\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element `\u003cst-container\u003e` anywhere in your template, JSX, html etc\n\n### Node Modules\n- Run `npm install stencil-container --save`\n- Put a script tag similar to this `\u003cscript src='node_modules/stencil-container/dist/stencil-container.js'\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element `\u003cst-container\u003e` anywhere in your template, JSX, html etc\n\n### In a stencil-starter app\n- Run `npm install stencil-container --save`\n- You might need to import the npm package in a tsx file with `import {  } from 'stencil-container';`\n- Then you can use the element `\u003cst-container\u003e` anywhere in your template, JSX, html etc\n\n## Parameters\n\n### st-if\n\nAn expression that is either true or false.\n\n## Examples\n\n### Plain html\n\n`\u003cst-container st-if=\"false\"\u003e\u003cdiv\u003efalse?\u003c/div\u003e\u003c/st-container\u003e`\nWill not show the child elements content.\n\n`\u003cst-container st-if=\"true\"\u003e\u003cdiv\u003etrue?\u003c/div\u003e\u003c/st-container\u003e`\nWill show the child elements content.\n\n`\u003cst-container\u003e\u003cdiv\u003econtainer test?\u003c/div\u003e\u003c/st-container\u003e`\nWithout the st-if parameter it assumes the content should be shown.\n\n### Javascript variables\n\n```html\n\u003cscript\u003e\n  var numberOne = 1;\n  var numberTwo = 2;\n  var booleanTrue = true;\n  var booleanFalse = false;\n\u003c/script\u003e\n\n\u003cst-container st-if=\"booleanTrue\"\u003e\u003cdiv\u003eWill be shown!\u003c/div\u003e\u003c/st-container\u003e\n\u003cst-container st-if=\"booleanFalse\"\u003e\u003cdiv\u003eWill not be shown!\u003c/div\u003e\u003c/st-container\u003e\n\u003cst-container st-if=\"numberOne\"\u003e\u003cdiv\u003eWill be shown!\u003c/div\u003e\u003c/st-container\u003e\n\u003cst-container st-if=\"numberTwo\"\u003e\u003cdiv\u003eWill be shown!\u003c/div\u003e\u003c/st-container\u003e\n\u003cst-container st-if=\"numberOne == numberOne\"\u003e\u003cdiv\u003eWill be shown!\u003c/div\u003e\u003c/st-container\u003e\n\u003cst-container st-if=\"numberOne == numberTwo\"\u003e\u003cdiv\u003eWill not be shown!\u003c/div\u003e\u003c/st-container\u003e\n```\n\n### JSX variables\n\n```jsx\nexport class MyApp {\n  private expression1 = '1 == 1';\n  private expression2 = '1 == 2';\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cst-container st-if={this.expression1}\u003e\u003cdiv\u003eWill be shown!\u003c/div\u003e\u003c/st-container\u003e\n        \u003cst-container st-if={this.expression2}\u003e\u003cdiv\u003eWill not be shown!\u003c/div\u003e\u003c/st-container\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n### Angular bindings\n\nLet me know if it works! :)\n\n## Development\n\nInstallation:\n```bash\ngit clone https://github.com/nerdic-coder/stencil-container.git stencil-container\ncd stencil-container\nnpm install\n```\n\nRunning:\n```bash\nnpm start\n```\n\nTests:\n```bash\nnpm run test\n```\n\nWatchable tests:\n```bash\nnpm run test.watch\n```\n\n## Blog article\n\nFeel free to read my blog article on how I created this stencil component,\n[How I created and published my first Stencil component](https://nerdic-coder.com/2018/05/27/how-i-created-and-published-my-first-stencil-component/)\n\nAll feedback are welcome!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdic-coder%2Fstencil-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerdic-coder%2Fstencil-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdic-coder%2Fstencil-container/lists"}