{"id":22710595,"url":"https://github.com/smallhelm/virtual-dom-absolute-layout","last_synced_at":"2025-03-29T21:42:43.615Z","repository":{"id":57392771,"uuid":"44696760","full_name":"smallhelm/virtual-dom-absolute-layout","owner":"smallhelm","description":"Easy way to layout elements via absolute positioning","archived":false,"fork":false,"pushed_at":"2015-10-23T02:00:32.000Z","size":152,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-16T00:49:00.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/smallhelm.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":"2015-10-21T18:40:13.000Z","updated_at":"2017-10-03T16:01:28.000Z","dependencies_parsed_at":"2022-09-26T16:51:27.397Z","dependency_job_id":null,"html_url":"https://github.com/smallhelm/virtual-dom-absolute-layout","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/smallhelm%2Fvirtual-dom-absolute-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fvirtual-dom-absolute-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fvirtual-dom-absolute-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fvirtual-dom-absolute-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallhelm","download_url":"https://codeload.github.com/smallhelm/virtual-dom-absolute-layout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249226,"owners_count":20747167,"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-12-10T12:10:42.634Z","updated_at":"2025-03-29T21:42:43.597Z","avatar_url":"https://github.com/smallhelm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# virtual-dom-absolute-layout\nEasy way to layout elements via absolute positioning\n\n## Example\n```js\nvar h = require(\"virtual-dom/h\");\nvar createElement = require(\"virtual-dom/create-element\");\nvar AbsoluteLayout = require(\"virtual-dom-absolute-layout\");\n\nvar Fill = function(color, text){\n  return h(\"div\", {\n    style: {\n      position: \"absolute\",\n      top: 0,\n      right: 0,\n      bottom: 0,\n      left: 0,\n      fontSize: \"30px\",\n      lineHeight: \"50px\",\n      textAlign: \"center\",\n      background: color\n    }\n  }, text);\n};\n\nvar render = function(){\n  return AbsoluteLayout(h, [\n    [Fill(\"lightgreen\", \"-- Header --\"), 50],\n\n    [Fill(\"yellow\", \"-- Sub-header --\"), 50],\n\n    [AbsoluteLayout(h, [\n\n      [Fill(\"lightblue\", \"-- Left --\"), 150],\n\n      [Fill(\"white\", \"-- Main Body --\")],\n\n      [Fill(\"red\", \"-- Right --\"), 150]\n\n    ], true)],\n\n    [Fill(\"pink\", \"-- Footer --\"), 50]\n  ]);\n};\ndocument.body.appendChild(createElement(render()));\n```\nOutput:\n![virtual-dom-absolute-layout example](https://raw.githubusercontent.com/smallhelm/virtual-dom-absolute-layout/master/example.png)\nAs the window resizes the layout adjusts giving more or less room for the Main Body.\n\nYou can also run this example by\n```sh\n$ npm i\n$ npm start\n```\nIt will give you a url to open in your browser. Edit example.js then refresh to see your changes.\n\n## API\n```js\nvar AbsoluteLayout = require(\"virtual-dom-absolute-layout\");\n```\n### AbsoluteLayout(h, blocks, is\\_horizontal)\n * `h` - hyperscript\n * `blocks` - [ [content, size], [content, size], ... ]\n * `is_horizontal` - set this to true if you want it to lay out horizontally\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fvirtual-dom-absolute-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallhelm%2Fvirtual-dom-absolute-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fvirtual-dom-absolute-layout/lists"}