Skip to content

Commit 8f07b82

Browse files
committed
Update indicator style docs
1 parent 664917e commit 8f07b82

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

versioned_docs/version-7.x/material-top-tab-navigator.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,16 @@ Function that returns a React element as the tab bar indicator.
410410

411411
Style object for the tab bar indicator.
412412

413+
The indicator takes the same width as the tab item by default. It can be customized in a few ways:
414+
415+
- To make it smaller by a certain amount, you can add a horizontal margin, e.g. `{ marginHorizontal: 10 }`.
416+
- Adding specific width will position the indicator at the left of the tab, e.g. `{ width: 20 }`.
417+
- To center it in the tab when a custom width is specified, you can specify `margin` as `'auto'`, e.g. `{ width: 20, marginHorizontal: 'auto' }`.
418+
419+
When the `tabStyle` has `width: 'auto'` and no explicit `width` is specified for the indicator, it is scaled to the width with `transform: [{ scaleX }]` for smooth animations. So specifying a `borderRadius` won't work as expected.
420+
421+
If you need more control, you can use [`tabBarIndicator`](#tabbarindicator) to render a custom indicator instead.
422+
413423
#### `tabBarIndicatorContainerStyle`
414424

415425
Style object for the view containing the tab bar indicator.

versioned_docs/version-7.x/tab-view.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,16 @@ By default, all tab items take up the same pre-calculated width based on the wid
442442

443443
Style to apply to the active indicator.
444444

445+
The indicator takes the same width as the tab item by default. It can be customized in a few ways:
446+
447+
- To make it smaller by a certain amount, you can add a horizontal margin, e.g. `{ marginHorizontal: 10 }`.
448+
- Adding specific width will position the indicator at the left of the tab, e.g. `{ width: 20 }`.
449+
- To center it in the tab when a custom width is specified, you can specify `margin` as `'auto'`, e.g. `{ width: 20, marginHorizontal: 'auto' }`.
450+
451+
When the `tabStyle` has `width: 'auto'` and no explicit `width` is specified for the indicator, it is scaled to the width with `transform: [{ scaleX }]` for smooth animations. So specifying a `borderRadius` won't work as expected.
452+
453+
If you need more control, you can use [`renderIndicator`](#renderindicator) to render a custom indicator instead.
454+
445455
##### `indicatorContainerStyle`
446456

447457
Style to apply to the container view for the indicator.

versioned_docs/version-8.x/material-top-tab-navigator.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,16 @@ Function that returns a React element as the tab bar indicator.
427427

428428
Style object for the tab bar indicator.
429429

430+
The indicator takes the same width as the tab item by default. It can be customized in a few ways:
431+
432+
- To make it smaller by a certain amount, you can add a horizontal margin, e.g. `{ marginHorizontal: 10 }`.
433+
- Adding specific width will position the indicator at the left of the tab, e.g. `{ width: 20 }`.
434+
- To center it in the tab when a custom width is specified, you can specify `margin` as `'auto'`, e.g. `{ width: 20, marginHorizontal: 'auto' }`.
435+
436+
When the `tabStyle` has `width: 'auto'` and no explicit `width` is specified for the indicator, it is scaled to the width with `transform: [{ scaleX }]` for smooth animations. So specifying a `borderRadius` won't work as expected.
437+
438+
If you need more control, you can use [`tabBarIndicator`](#tabbarindicator) to render a custom indicator instead.
439+
430440
#### `tabBarIndicatorContainerStyle`
431441

432442
Style object for the view containing the tab bar indicator.

versioned_docs/version-8.x/tab-view.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,16 @@ By default, all tab items take up the same pre-calculated width based on the wid
512512

513513
Style to apply to the active indicator.
514514

515+
The indicator takes the same width as the tab item by default. It can be customized in a few ways:
516+
517+
- To make it smaller by a certain amount, you can add a horizontal margin, e.g. `{ marginHorizontal: 10 }`.
518+
- Adding specific width will position the indicator at the left of the tab, e.g. `{ width: 20 }`.
519+
- To center it in the tab when a custom width is specified, you can specify `margin` as `'auto'`, e.g. `{ width: 20, marginHorizontal: 'auto' }`.
520+
521+
When the `tabStyle` has `width: 'auto'` and no explicit `width` is specified for the indicator, it is scaled to the width with `transform: [{ scaleX }]` for smooth animations. So specifying a `borderRadius` won't work as expected.
522+
523+
If you need more control, you can use [`renderIndicator`](#renderindicator) to render a custom indicator instead.
524+
515525
##### `indicatorContainerStyle`
516526

517527
Style to apply to the container view for the indicator.

0 commit comments

Comments
 (0)