React Material:UI Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The centered property is just a convenient way of specifying the justifyContent style on the Tabs component. Whenever there is a property to style Material-UI components in a specific way, you should use it instead of applying your own styles. Future versions of the library could include fixes that rely on the property that you'll miss out on.

Another reason to style components using the property is that Material-UI might behave differently depending on how other properties are set. For example, with the Tabs component, you can't set the centered property while the scrollable property is set to true; Material-UI checks for this and handles it.

The fullWidth value of the variant property is actually passed to the Tab component, which alters the styles it uses based on this value. The result is the even spacing of tabs within the container element.

You can set the centered and variant properties at the same time. However, centered isn't necessary if  variant has a value of fullWidth. Using both is harmless though.