diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-04-24 20:09:41 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-04-24 20:09:41 +0200 |
commit | 7bc2dce08659b7cbcb3fd1865c7e3d95e8c42c52 (patch) | |
tree | 83461d93a148f793f1b65989664221c5cad3660c /src/main/kotlin/pl | |
parent | 9c736b48393b26b7e3bfe7b9fc36084b185502f5 (diff) | |
download | kvision-7bc2dce08659b7cbcb3fd1865c7e3d95e8c42c52.tar.gz kvision-7bc2dce08659b7cbcb3fd1865c7e3d95e8c42c52.tar.bz2 kvision-7bc2dce08659b7cbcb3fd1865c7e3d95e8c42c52.zip |
Scrollable tabs for TabPanel
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt index b98ea1ad..5a4fac0c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt @@ -59,12 +59,14 @@ enum class SideTabSize { * @constructor * @param tabPosition tab position * @param sideTabSize side tab size + * @param scrollableTabs determines if tabs are scrollable (default: false) * @param classes a set of CSS class names * @param init an initializer extension function */ open class TabPanel( private val tabPosition: TabPosition = TabPosition.TOP, private val sideTabSize: SideTabSize = SideTabSize.SIZE_3, + scrollableTabs: Boolean = false, classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? = null ) : SimplePanel(classes) { @@ -86,7 +88,7 @@ open class TabPanel( } } private val navClasses = when (tabPosition) { - TabPosition.TOP -> setOf("nav", "nav-tabs") + TabPosition.TOP -> if (scrollableTabs) setOf("nav", "nav-tabs", "tabs-top") else setOf("nav", "nav-tabs") TabPosition.LEFT -> setOf("nav", "nav-tabs", "tabs-left") TabPosition.RIGHT -> setOf("nav", "nav-tabs", "tabs-right") } @@ -205,10 +207,11 @@ open class TabPanel( fun Container.tabPanel( tabPosition: TabPosition = TabPosition.TOP, sideTabSize: SideTabSize = SideTabSize.SIZE_3, + scrollableTabs: Boolean = false, classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? = null ): TabPanel { - val tabPanel = TabPanel(tabPosition, sideTabSize, classes, init) + val tabPanel = TabPanel(tabPosition, sideTabSize, scrollableTabs, classes, init) this.add(tabPanel) return tabPanel } |