Skip to content

Conversation

@kurucaner
Copy link

Description

This PR adds an allowFontScaling prop to the MaterialTabItem component to control whether the tab label text should respect the device's text size accessibility settings.

Changes

  • Added allowFontScaling prop to MaterialTabItemProps interface
  • Implemented the prop in MaterialTabItem component with a default value of true
  • Updated MaterialTabBar to pass the prop to each tab item
  • Added the prop to the README documentation
  • Memoized the MaterialTabItem component and added displayName

Use Case

This prop is particularly useful in scenarios where maintaining the exact layout of tabs is important regardless of the user's accessibility settings. By setting allowFontScaling={false}, developers can ensure that tab labels maintain a consistent size across all devices.

Example Usage

    <Tabs.Container
      renderTabBar={(props) => (
        <MaterialTabBar {...props} allowFontScaling={false} />
      )}
    >
      {/* Tab content */}
    </Tabs.Container>

Files Changed

  • src/MaterialTabBar/types.ts
  • src/MaterialTabBar/TabItem.tsx
  • src/MaterialTabBar/TabBar.tsx
  • README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant