Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Material Tab control - RTL

When applying RTL direction to Angualr Material Tabs control, the animation breaks when toggling between tabs.

<div dir="rtl">
  <mat-tab-group>
    <mat-tab label="Tab 1">Content 1</mat-tab>
    <mat-tab label="Tab 2">Content 2</mat-tab>
  </mat-tab-group>
</div>

Is there a known fix to this ?

reproduce demo

like image 636
Stavm Avatar asked Sep 24 '26 03:09

Stavm


2 Answers

you need to put dir in mat-tab-group itself and container must be ltr

<div dir="ltr">
  <mat-tab-group  dir="rtl">
    <mat-tab label="Tab 1">Content 1</mat-tab>
    <mat-tab label="Tab 2">Content 2</mat-tab>
  </mat-tab-group>
</div>
like image 193
ProSheta Avatar answered Sep 25 '26 19:09

ProSheta


This is a bug probably, But you can fix it with this workaround for now. set some css in your page:

.mat-tab-header{
direction:rtl;
}
.mat-tab-body-wrapper{
text-align:right
}

Working Demo

like image 37
molikh Avatar answered Sep 25 '26 18:09

molikh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!