Skip to content

Provide a non-nestable version of Tabs component #14

Open
@andersevenrud

Description

@andersevenrud

Currently the Tabs component is using hyperapp-nestable, which is great, but when you update a component property, it will not react to this unless you specify a key.

The downside to this is that it will force you to re-render the component.

To get around this, a slightly different version of the tabs component could be added:

app({
  selectedTab: -1,
  tabs: ['My Tab']
}, {
  setSelectedTab: selectedTab => ({selectedTab})
}, (state, actions) => {
  return h(Tabs, {
    selectedIndex: state.selectedTab,
    labels: state.tabs,
    onchange: (ev, index) => actions.setSelectedTab(index)
  }, [
    h(Box, {}, 'Tab contents'}
  ]);
}, $content);

This requires developer to wire up the tab switch event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions