R

ReflexKR

Reflex公式ドキュメント

コンポーネント工房:Reflexライブラリ100

·

講座の概要

レイアウト

·

Box

·

Flex

·

Stack

·

Grid

·

Container

·

Section

·

Center

·

Spacer

·

Separator

·

Card

·

Inset

·

Aspect Ratio

·

Fragment

タイポグラフィ

·

Text

·

Heading

·

Link

·

Code

·

Markdown

·

Blockquote

·

Quote

·

Strong

·

Em

·

Kbd

フォーム

·

Button

·

Input

·

Text Area

·

Checkbox

·

Switch

·

Radio Group

·

Select

·

Slider

·

Form

·

Upload

データ表示

·

Badge

·

Avatar

·

Icon

·

Callout

·

List

·

Data List

·

Code Block

·

Progress

·

Spinner

·

Scroll Area

·

Moment

開閉と切り替え

·

Tabs

·

Accordion

·

Segmented Control

オーバーレイ

·

Tooltip

·

Popover

·

Hover Card

·

Dialog

·

Alert Dialog

·

Drawer

·

Dropdown Menu

·

Context Menu

·

Toast

動的レンダリング

·

Cond

·

Match

·

Foreach

·

Auto Scroll

メディア

·

Image

·

Audio

·

Video

表とデータグリッド

·

Table

·

Data Table

·

Data Editor

チャート

·

Area Chart

·

Bar Chart

·

Line Chart

·

Composed Chart

·

Pie Chart

·

Radar Chart

·

Radial Bar Chart

·

Scatter Chart

·

Funnel Chart

·

Treemap

·

Sankey Chart

·

Error Bar

チャートの部品

·

Axis

·

Cartesian Grid

·

Chart Tooltip

·

Legend

·

Label

·

Reference

·

Brush

ほかのチャートライブラリ

·

Plotly

·

Pyplot

HTML要素

·

HTML

·

HTML Text

·

HTML Layout

·

HTML Forms

·

HTML Media

·

HTML Tables

·

SVG

そのほかの道具

·

Theme

·

Skeleton

·

Clipboard

·

Html Embed

·

Script

·

Memo

コンポーネント工房:Reflexライブラリ100
データ表示

Scroll Area

工房の注文書

通知ボックスは高さを固定し、通知が増えたらボックスの中だけでスクロールするようにしてください。

rx.scroll_areaは、決まった大きさの中で内容をスクロールする領域です。ブラウザ標準のスクロール機能をそのまま使いながら、スクロールバーだけをどのブラウザでも同じ見た目で描きます。高さ(または幅)を決めておかないと、その中でスクロールは生まれません。

Three fundamental aspects of typography are legibility, readability, and aesthetics. Although in a non-technical sense legible and readable are often used synonymously, typographically they are separate but related concepts.

Legibility describes how easily individual characters can be distinguished from one another. For instance, if a b and an h, or a 3 and an 8, are difficult to distinguish at small sizes, this is a problem of legibility.

Typographers are concerned with legibility insofar as it is their job to select the correct font to use. Using only uppercase letters reduces legibility.

rx.scroll_area(
    rx.flex(
        rx.text(
            "Three fundamental aspects of typography are legibility, readability, and aesthetics. "
            "Although in a non-technical sense legible and readable are often used synonymously, "
            "typographically they are separate but related concepts."
        ),
        rx.text(
            "Legibility describes how easily individual characters can be distinguished from one another. "
            "For instance, if a b and an h, or a 3 and an 8, are difficult to distinguish at small sizes, "
            "this is a problem of legibility."
        ),
        rx.text(
            "Typographers are concerned with legibility insofar as it is their job to select the correct font to use. "
            "Using only uppercase letters reduces legibility."
        ),
        direction="column",
        spacing="4",
        padding_right="16px",
    ),
    type="always",
    scrollbars="vertical",
    height="180px",
)

プロパティを変えてみる

下の領域は縦にも横にもはみ出しています。scrollbarsでどの方向にスクロールするかを、typeでスクロールバーがいつ表示されるかを決めます。

プロパティを変えてみる

Card 1

Card 2

Card 3

Card 4

Card 5

Card 6

Card 7

Card 8

Card 9

Card 10

Card 11

Card 12

Card 13

Card 14

Card 15

Card 16

Card 17

Card 18

Card 19

Card 20

Card 21

Card 22

Card 23

Card 24

Card 25

Card 26

Card 27

Card 28

Card 29

Card 30

Card 31

Card 32

Card 33

Card 34

Card 35

Card 36

Card 37

Card 38

Card 39

Card 40

type

scrollbars

rx.scroll_area(
    rx.grid(
        *[rx.card(rx.text("Card ", i)) for i in range(1, 41)],
        columns="8",
        spacing="2",
        width="900px",
        padding="8px",
    ),
    type="hover",
    scrollbars="both",
    height="180px",
)
scrollbarsをverticalにすると、横にはみ出した部分はスクロールされずに切れます。typeがhoverかscrollなら、マウスを乗せたりスクロールしたりしたときだけバーが表示されます。
プロパティ値既定値用途
scrollbars"vertical" "horizontal" "both""both"スクロールする方向
type"auto" "always" "scroll" "hover""hover"スクロールバーが表示されるタイミング
scroll_hide_delay整数(ミリ秒)600scroll・hoverのとき、操作をやめてからバーが消えるまでの時間
height / widthCSSの長さなし領域の大きさ。これをはみ出す内容がスクロールされる

スクロールの方向を決める

scrollbarsはスクロールする軸を決めます。左から縦だけ、横だけ、両方です。横にスクロールさせるには、内側の内容が領域より広くなければなりません。

Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical. Vertical.

Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal. Horizontal.

Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways. Both ways.

rx.grid(
    rx.scroll_area(
        rx.text("Vertical. " * 40, size="2", padding="8px", padding_right="24px"),
        type="always",
        scrollbars="vertical",
        height="150px",
    ),
    rx.scroll_area(
        rx.text("Horizontal. " * 40, size="2", padding="8px", width="700px"),
        type="always",
        scrollbars="horizontal",
        height="150px",
    ),
    rx.scroll_area(
        rx.text("Both ways. " * 60, size="2", padding="8px", width="400px"),
        type="always",
        scrollbars="both",
        height="150px",
    ),
    columns="3",
    spacing="3",
)

スクロールバーが表示されるタイミング

typeはスクロールバーをいつ表示するかを決めます。

  • auto: 内容がはみ出すときだけ表示されます。
  • always: はみ出していてもいなくても常に表示されます。
  • scroll: その方向にスクロールしている間、表示されます。
  • hover: スクロールしている間と、マウスを領域に乗せたときに表示されます。

type = 'auto'

Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished.

type = 'always'

Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished.

type = 'scroll'

Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished.

type = 'hover'

Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished. Legibility describes how easily individual characters can be distinguished.

rx.grid(
    *[
        rx.scroll_area(
            rx.flex(
                rx.text("type = '" + t + "'", weight="bold"),
                rx.text("Legibility describes how easily individual characters can be distinguished. " * 4, size="2"),
                direction="column",
                spacing="2",
                padding="8px",
                padding_right="20px",
            ),
            type=t,
            scrollbars="vertical",
            height="150px",
        )
        for t in ["auto", "always", "scroll", "hover"]
    ],
    columns="4",
    spacing="3",
)

消えるまでの時間

typeが"scroll"か"hover"のとき、scroll_hide_delayは操作をやめてからバーが消えるまでの時間(ミリ秒)です。2つの領域をスクロールして手を離してみると、違いがわかります。

Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast. Hides fast.

Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds. Stays for 3 seconds.

rx.grid(
    rx.scroll_area(
        rx.text("Hides fast. " * 50, size="2", padding="8px", padding_right="20px"),
        type="scroll",
        scroll_hide_delay=200,
        height="120px",
    ),
    rx.scroll_area(
        rx.text("Stays for 3 seconds. " * 40, size="2", padding="8px", padding_right="20px"),
        type="scroll",
        scroll_hide_delay=3000,
        height="120px",
    ),
    columns="2",
    spacing="3",
)

注文書を仕上げる

カードの中の通知リストの高さを固定しました。通知が増えてもカードの大きさは変わらず、マウスを乗せるとスクロールバーが現れます。

Notifications

Order #1001 has shipped.

Order #1002 has shipped.

Order #1003 has shipped.

Order #1004 has shipped.

Order #1005 has shipped.

Order #1006 has shipped.

Order #1007 has shipped.

Order #1008 has shipped.

Order #1009 has shipped.

Order #1010 has shipped.

Order #1011 has shipped.

Order #1012 has shipped.

Order #1013 has shipped.

Order #1014 has shipped.

Order #1015 has shipped.

rx.card(
    rx.text("Notifications", weight="bold", margin_bottom="2"),
    rx.scroll_area(
        rx.vstack(
            *[
                rx.hstack(
                    rx.avatar(fallback=str(i), size="2", radius="full"),
                    rx.text("Order #" + str(1000 + i) + " has shipped.", size="2"),
                    align="center",
                    padding_right="16px",
                )
                for i in range(1, 16)
            ],
            spacing="3",
        ),
        type="hover",
        scrollbars="vertical",
        height="220px",
    ),
    max_width="340px",
)

工房ノート

  • rx.scroll_area(内容, height=…)で、決まった大きさの中だけでスクロールする。

  • scrollbars: vertical · horizontal · both(既定)。

  • type: auto · always · scroll · hover(既定)。scroll_hide_delayで消えるまでの時間。

  • スクロールバーが文字に重ならないよう、内側の内容にpadding_rightを少し付ける。

← 前へ

データ表示 · Spinner

次へ →

データ表示 · Moment

新しい授業・講座のお知らせを受け取る

この講座に授業が追加されたり、続きの講座が公開されたりしたらメールでお知らせします。

収集項目:メールアドレス・目的:この講座の新しい授業・公開のお知らせ・保有期間:解除のご依頼まで。他の目的には使わず、第三者にも提供しません。お知らせメールに返信いただければすぐに削除します。

質問と回答

この回について気になることを書き込んでください。すべての言語のページの質問がここに集まります。

リンクや書式なしで、そのままの文字で表示されます。

R

ReflexKR

触って学ぶPythonとReflex。すべての例はReflex 0.10.0で実際に動かして確認しています。

ReflexKRはバナー広告なし・無料で運営しています。役に立ったら、コーヒー一杯で応援してください。 ☕ コーヒーで応援する

アフィリエイトと支援について
한국어English日本語简体中文EspañolDeutsch

© 2026 ReflexKR · Since 2026 · CC BY-NC 4.0

Built with Reflex