0Pricing
Jetpack Compose Academy · レッスン

ラベル、プレースホルダー、先頭アイコン

入力欄をわかりやすく親しみやすくします。

「ラベル、プレースホルダー、先頭アイコン」はCoddyKit上の無料Jetpack Compose Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはJetpack Compose Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Jetpack Compose Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Make Inputs Friendly

A bare box leaves users guessing. Labels, placeholders, and icons turn a plain field into one that guides the user. 🧭

The label Slot

The label names the field. It sits inside when empty, then floats up to the border once the field is focused or filled.

OutlinedTextField(
    value = email,
    onValueChange = { email = it },
    label = { Text("Email") }
)

Add a Placeholder

A placeholder is hint text shown only while the field is empty. Use it for an example, not for the field's name.

placeholder = { Text("you@example.com") }

Label vs Placeholder

The label always stays visible to identify the field. The placeholder vanishes the instant the user starts typing. Use both together.

Leading Icons

A leadingIcon sits at the start of the field. An envelope next to an email box makes its purpose obvious at a glance.

leadingIcon = {
    Icon(Icons.Default.Email, contentDescription = null)
}

Trailing Icons Too

A trailingIcon sits at the end. It is perfect for a clear button or a password visibility toggle.

trailingIcon = {
    Icon(Icons.Default.Clear, contentDescription = "Clear")
}

Always Describe Icons

Give each Icon a contentDescription so screen readers can announce it. Pass null only when the icon is purely decorative.

Make the Trailing Icon Tappable

Wrap a trailing icon in an IconButton so users can tap it, for example to clear the field in one touch.

trailingIcon = {
    IconButton(onClick = { email = "" }) {
        Icon(Icons.Default.Clear, "Clear")
    }
}

Supporting Text

supportingText shows a small hint below the field, like a format reminder or a character limit, without crowding the input.

supportingText = { Text("We never share your email.") }

Combine Them Thoughtfully

Label plus icon plus a short placeholder is plenty. Too many hints add noise, so keep each field calm and clear.

Slots Are Just Composables

Every slot, like label and leadingIcon, is a lambda holding Composables. That means you can put any UI you want inside them.

Quick Check

When does a placeholder disappear from a text field?

Recap

You dressed up inputs with a label, placeholder hints, leading and trailing icons, and supporting text. Friendly fields, happy users. 😊

よくある質問

「ラベル、プレースホルダー、先頭アイコン」レッスンは無料ですか?

はい。「ラベル、プレースホルダー、先頭アイコン」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Jetpack Compose Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Jetpack Compose Academyコースには全4レッスンが含まれています。

「ラベル、プレースホルダー、先頭アイコン」で何を学びますか?

入力欄をわかりやすく親しみやすくします。 ブラウザで直接実行するハンズオンコードでJetpack Compose Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Jetpack Compose Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのJetpack Compose Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「ラベル、プレースホルダー、先頭アイコン」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このJetpack Compose Academyレッスンでコードを書いて実行できますか?

はい。すべてのJetpack Compose Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. TextFieldとOutlinedTextField
  2. ラベル、プレースホルダー、先頭アイコン
  3. キーボードの種類とIMEアクション
  4. インライン検証とエラー状態
← Jetpack Compose Academyに戻る