Skip to content

CSS: progress

.instui-progress · stable — แถบความคืบหน้าที่มีค่าแน่นอนพร้อมมาตรวัดมีสี ขนาดต่าง ๆ และป้ายแสดงค่าแบบเลือกได้

.value เป็นพี่น้องของ .bar ทั้งคู่เป็นลูกของรูท — สะท้อนการที่ progress-circle ฝังส่วน .value ของตัวเองไว้ด้วย InstUI ไม่มีสถานะไม่แน่นอน; :indeterminate เป็นการประมาณที่เฉพาะ pantoken (native <progress> ที่ไม่มีแอตทริบิวต์ value) โดยจะอนิเมต .bar เป็นส่วนเลื่อนและซ่อน .value เพราะไม่มีตัวเลขที่มีความหมายให้แสดง <meter> ไม่มีสถานะไม่แน่นอน จึงไม่ถูกกระทบ

Source: progress.css

การเข้าถึง

ใช้ native <progress> สำหรับช่วงการทำงานที่เริ่มจากศูนย์ และใช้ <meter> เมื่อค่าต่ำสุดไม่เป็นศูนย์ ให้ชื่อที่เข้าถึงได้แก่แต่ละองค์ประกอบโดยซ้อนภายใน <label> หรือเชื่อมโยงกับ <label> แยกต่างหากผ่านการจับคู่ค่า for และ id.

การใช้งาน

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/progress.css";

ตัวอย่าง

Nested label

html
<label>
  Uploading Document: <progress class="instui-progress -color-brand" value="70">70%</progress>
</label>

External label

html
<label for="storage-used">Storage used</label>
<meter id="storage-used" class="instui-progress -color-warning" min="20" value="40" max="60">50%</meter>

โครงสร้าง

// Variant: nested-label

text
label
  .instui-progress
    .bar
    .value

// Variant: external-label

text
label
.instui-progress
  .bar
  .value
flowchart TD subgraph sg0 ["nested-label"] n1["label"]:::cssdoc-root n2(".instui-progress"):::cssdoc-part n3(".bar"):::cssdoc-part n4(".value"):::cssdoc-part end subgraph sg5 ["external-label"] n6["label"]:::cssdoc-root n7[".instui-progress"]:::cssdoc-root n8(".bar"):::cssdoc-part n9(".value"):::cssdoc-part end n2 --> n3 n2 --> n4 n1 --> n2 n7 --> n8 n7 --> n9 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

ตัวปรับแต่ง

ตัวปรับแต่งคำอธิบาย
.-color-brandสีมาตรวัดแบรนด์.
.-color-dangerสีมาตรวัดอันตราย.
.-color-infoสีมาตรวัดข้อมูลแจ้งเตือน.
.-color-inverseสำหรับพื้นหลังสีเข้ม
.-color-primary-inverseสีมาตรวัดบนพื้นมืด (primary inverse).
.-color-successสีมาตรวัดความสำเร็จ.
.-color-warningสีมาตรวัดเตือน.
.-meter-color-alertเลิกใช้ — use .-color-warning.
.-meter-color-brandเลิกใช้ — use .-color-brand.
.-meter-color-dangerเลิกใช้ — use .-color-danger.
.-meter-color-infoเลิกใช้ — use .-color-info.
.-meter-color-successเลิกใช้ — use .-color-success.
.-meter-color-warningเลิกใช้ — use .-color-warning.
.-render-value-insideเรนเดอร์ .value ภายในแทร็ก จัดชิดจุดเริ่มต้น แทนที่จะวางข้าง ๆ; ปรับสไตล์ให้อ่านได้ชัดเหนือสีมาตรวัด
.-should-animateInteraction — Animate meter changes over half a second.
.-size-largeใหญ่. ชื่อยาวของ -size-lg.
.-size-lgใหญ่.
.-size-mdขนาดกลาง (ค่าเริ่มต้น).
.-size-mediumขนาดกลาง (ค่าเริ่มต้น). นามแฝงแบบยาวของ -size-md.
.-size-smเล็ก.
.-size-smallเล็ก. ชื่อยาวของ -size-sm.
.-size-x-smallเล็กพิเศษ. ชื่อยาวของ -size-xs.
.-size-xsเล็กพิเศษ.

ส่วนประกอบ

ส่วนคำอธิบาย
.barแถบมาตรวัดที่ถูกเติม
.valueข้อความค่าที่วางข้างแถบ

องค์ประกอบเทียม

องค์ประกอบเทียมคำอธิบาย
:::indeterminateกำหนดเอง, ไม่ใช่ส่วนหนึ่งของ InstUI ใช้กับ native <progress> ที่ไม่มีแอตทริบิวต์ value เท่านั้น; อนิเมต .bar เป็นส่วนเลื่อนและซ่อน .value
::afterวาดเส้นขอบล่างของแทร็กเป็นเลเยอร์แยกเหนือมาตรวัด เพื่อให้กรอบเต็มและขอบล่างยังคงเป็นอิสระกันข้ามธีม

สถานะ

สถานะคำอธิบาย
:indeterminate

พร็อพเพอร์ตีที่กำหนดเอง

คุณสมบัติชนิดค่าเริ่มต้นคำอธิบาย
--max<number>ค่าสูงสุดของความคืบหน้า (ค่าเริ่มต้น 100).
--min<number>ค่าต่ำสุดของมาตรวัด (ค่าเริ่มต้น 0).
--value<number>ค่าความคืบหน้าปัจจุบัน
--value-max<number>@alias {@link --max} ค่าสูงสุดของความคืบหน้า (ค่าเริ่มต้น 100).
--value-now<number>@alias นามแฝงของ --value.

แอนิเมชัน

แอนิเมชันคำอธิบาย
pantoken-progress-indeterminate

โทเค็นที่ใช้

Tokenชนิดค่า
--instui-color-background-brand<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-color-background-error<color>#E62429
--instui-color-background-info<color>#2B7ABC
--instui-color-background-success<color>#03893D
--instui-color-background-warning<color>#CF4A00
--instui-component-progress-bar-border-color<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-component-progress-bar-border-color-inverse<color>LightDarklight-dark(#ffffff, #6A7883)
--instui-component-progress-bar-border-radius<length>0.5rem
--instui-component-progress-bar-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-progress-bar-font-weight<integer>400
--instui-component-progress-bar-large-height<length>2rem
--instui-component-progress-bar-line-height<percentage>125%
--instui-component-progress-bar-medium-height<length>1.5rem
--instui-component-progress-bar-medium-value-font-size<length>1rem
--instui-component-progress-bar-meter-color-brand-inverse<color>LightDarklight-dark(#ffffff, #10141A)
--instui-component-progress-bar-small-height<length>1rem
--instui-component-progress-bar-text-color<color>LightDarklight-dark(#576773, #AAB0B5)
--instui-component-progress-bar-text-color-inverse<color>LightDarklight-dark(#ffffff, #1C222B)
--instui-component-progress-bar-track-bottom-border-color<color>#00000000
--instui-component-progress-bar-track-bottom-border-color-inverse<color>#00000000
--instui-component-progress-bar-track-bottom-border-width<length>0.0625rem
--instui-component-progress-bar-track-color<color>#00000000
--instui-component-progress-bar-track-color-inverse<color>#00000000
--instui-component-progress-bar-value-padding<length>0.5rem
--instui-component-progress-bar-x-small-height<length>0.5rem

รองรับเบราว์เซอร์

  • ขอบเขตกฎของส่วนมาตรวัดด้วย at-rule @scope; เบราว์เซอร์ที่ไม่รองรับ @scope จะละเว้นกฎที่ถูกขอบเขตนั้น

ที่เกี่ยวข้อง

  • progress-circle — รูปแบบวงกลมของแถบความคืบหน้าแบบเดียวกันที่มีค่าแน่นอน