{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Auto Scrolling","type":"basic","slug":"auto-scrolling","excerpt":"","body":"When navigating with keys or clicking a node in the edges of the screen, the tree will automatically try to scroll the selected node into view.\nAlso, you can call `scrollIntoView` on any node to make it visible.\n[block:api-header]\n{\n  \"title\": \"Inner Scroll\"\n}\n[/block]\nAuto scrolling is built-in to the tree. Simply wrap the tree with a container that has a height and you're good.\nThe tree has an inner element called viewport that is scrollable.\n[block:api-header]\n{\n  \"title\": \"External Scroll (Scrolling as part of the body / other container)\"\n}\n[/block]\nSometimes you don't want to wrap the tree with a scrollable container, and want the scrolling to be part of a different element.\nUse the `scrollContainer` option for this purpose as described in [Options](doc:options-2) \n[block:api-header]\n{\n  \"title\": \"Demo of scrollContainer\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<iframe src=\\\"https://angular-tree-component.azurewebsites.net/#/scroll-container\\\" width=\\\"500px\\\" height=\\\"300px\\\"></iframe>\\n\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<a href=\\\"https://github.com/CirclonGroup/angular-tree-component/blob/master/projects/example-app/src/app/scrollcontainer/scrollcontainer.component.ts\\\" target=\\\"_blank\\\">Source code for this demo</a>\"\n}\n[/block]","updates":[],"order":12,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5c27be9e2b75bd0045dc7475","project":"5707c6875309d117006948d4","version":{"version":"8.2.0","version_clean":"8.2.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5c27be9e2b75bd0045dc7458","5c27be9e2b75bd0045dc7459","5c27be9e2b75bd0045dc745a"],"_id":"5c27be9e2b75bd0045dc7476","project":"5707c6875309d117006948d4","__v":0,"forked_from":"5b65b08eb1906e000319f872","createdAt":"2018-03-23T13:06:33.352Z","releaseDate":"2018-03-23T13:06:33.352Z"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Guides","slug":"documentation","order":1,"from_sync":false,"reference":false,"_id":"5c27be9e2b75bd0045dc7459","version":"5c27be9e2b75bd0045dc7476","project":"5707c6875309d117006948d4","createdAt":"2016-04-08T14:56:07.661Z","__v":0},"user":"54d742a80771980d0052f4b5","createdAt":"2018-05-18T19:29:46.638Z","githubsync":"","__v":0,"parentDoc":null}
When navigating with keys or clicking a node in the edges of the screen, the tree will automatically try to scroll the selected node into view. Also, you can call `scrollIntoView` on any node to make it visible. [block:api-header] { "title": "Inner Scroll" } [/block] Auto scrolling is built-in to the tree. Simply wrap the tree with a container that has a height and you're good. The tree has an inner element called viewport that is scrollable. [block:api-header] { "title": "External Scroll (Scrolling as part of the body / other container)" } [/block] Sometimes you don't want to wrap the tree with a scrollable container, and want the scrolling to be part of a different element. Use the `scrollContainer` option for this purpose as described in [Options](doc:options-2) [block:api-header] { "title": "Demo of scrollContainer" } [/block] [block:html] { "html": "<iframe src=\"https://angular-tree-component.azurewebsites.net/#/scroll-container\" width=\"500px\" height=\"300px\"></iframe>\n" } [/block] [block:html] { "html": "<a href=\"https://github.com/CirclonGroup/angular-tree-component/blob/master/projects/example-app/src/app/scrollcontainer/scrollcontainer.component.ts\" target=\"_blank\">Source code for this demo</a>" } [/block]