9
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Vuetifyのv-btnのアルファベットが大文字になるのはなぜ?

Last updated at Posted at 2020-07-16

Vuetifyのv-btnのアルファベットが大文字になるのはなぜ?

マテリアルデザインの仕様である

Button anatomy - Material Design
Button Text button - Material Design

マテリアルデザインでは基本的にボタンのテキストにはアッパーケースのアルファベットを用います。
こちらを元にVuetifyではcssでtext-transformでアルファベットを大文字に変えています。

スクリーンショット 2020-07-16 12.12.15.png

解決法1. CSS

How to make the global text not uppercase/capitalize - GitHub

特定のコンポーネント全体に適用したい場合はstyleに下記を指定して上書きする。


<style scoped>
*{ text-transform: none !important; }
</style>

私のおすすめはVuetifyのv-btnをそのまま使わずにSubmitButton.vueのようなファイルを作り、
そのコンポーネント内にスタイルを当てる方法をおすすめします。

解決法2. Vuetifyのclassの指定

Text and typography Text transform - Vuetify

下記が利用例になります。
ご覧の通り大文字化を防ぐスタイルが当てられているのではなく、先頭大文字にするスタイルが当てられている点に注意してください。

<!-- 表示: 「Submit」 -->
<v-btn class="text-capitalize">Submit</v-btn>

<!-- 表示: 「Submit Low Text」 -->
<v-btn class="text-capitalize">Submit low text</v-btn>

<!-- 表示: 「Submit TextTest」 -->
<v-btn class="text-capitalize">Submit testTest</v-btn>

<!-- 表示: 「Submitボタン」 -->
<v-btn class="text-capitalize">submitボタン</v-btn>
9
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?