1/* 2* Copyright (C) 2023 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21 22 23 24import { SymbolGlyphModifier } from './@ohos.arkui.modifier'; 25 26/** 27 * Enum for ChipSize 28 * 29 * @enum { string } 30 * @syscap SystemCapability.ArkUI.ArkUI.Full 31 * @crossplatform 32 * @since 11 33 */ 34/** 35 * Enum for ChipSize 36 * 37 * @enum { string } 38 * @syscap SystemCapability.ArkUI.ArkUI.Full 39 * @crossplatform 40 * @atomicservice 41 * @since 12 42 */ 43 44export declare enum ChipSize { 45 46 /** 47 * Normal type. 48 * 49 * @syscap SystemCapability.ArkUI.ArkUI.Full 50 * @crossplatform 51 * @since 11 52 */ 53 /** 54 * Normal type. 55 * 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @crossplatform 58 * @atomicservice 59 * @since 12 60 */ 61 NORMAL = "NORMAL", 62 63 /** 64 * Small type. 65 * 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @crossplatform 68 * @since 11 69 */ 70 /** 71 * Small type. 72 * 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @crossplatform 75 * @atomicservice 76 * @since 12 77 */ 78 SMALL = "SMALL" 79} 80 81/** 82 * Defines the icon common option. 83 * 84 * @interface IconCommonOptions 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @crossplatform 87 * @since 11 88 */ 89 /** 90 * Defines the icon common option. 91 * 92 * @interface IconCommonOptions 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @crossplatform 95 * @atomicservice 96 * @since 12 97 */ 98export interface IconCommonOptions { 99 100 /** 101 * Image resource. 102 * 103 * @type { ResourceStr } 104 * @syscap SystemCapability.ArkUI.ArkUI.Full 105 * @crossplatform 106 * @since 11 107 */ 108 /** 109 * Image resource. 110 * 111 * @type { ResourceStr } 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @crossplatform 114 * @atomicservice 115 * @since 12 116 */ 117 src: ResourceStr; 118 119 /** 120 * Image size option. 121 * 122 * @type { ?SizeOptions } 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @crossplatform 125 * @since 11 126 */ 127 /** 128 * Image size option. 129 * 130 * @type { ?SizeOptions } 131 * @syscap SystemCapability.ArkUI.ArkUI.Full 132 * @crossplatform 133 * @atomicservice 134 * @since 12 135 */ 136 size?: SizeOptions; 137 138 /** 139 * Image filled color. 140 * 141 * @type { ?ResourceColor } 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @crossplatform 144 * @since 11 145 */ 146 /** 147 * Image filled color. 148 * 149 * @type { ?ResourceColor } 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @crossplatform 152 * @atomicservice 153 * @since 12 154 */ 155 fillColor?: ResourceColor; 156 157 /** 158 * Image filled color when chip is activated. 159 * 160 * @type { ?ResourceColor } 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @crossplatform 163 * @atomicservice 164 * @since 12 165 */ 166 activatedFillColor?: ResourceColor; 167} 168 169/** 170 * Defines the suffix icon option. 171 * 172 * @interface SuffixIconOptions 173 * @extends IconCommonOptions 174 * @syscap SystemCapability.ArkUI.ArkUI.Full 175 * @crossplatform 176 * @since 11 177 */ 178 /** 179 * Defines the suffix icon option. 180 * 181 * @interface SuffixIconOptions 182 * @extends IconCommonOptions 183 * @syscap SystemCapability.ArkUI.ArkUI.Full 184 * @crossplatform 185 * @atomicservice 186 * @since 12 187 */ 188export interface SuffixIconOptions extends IconCommonOptions { 189 190 /** 191 * Called when the suffix icon is clicked. 192 * 193 * @type { ?function } 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @crossplatform 196 * @since 11 197 */ 198 /** 199 * Called when the suffix icon is clicked. 200 * 201 * @type { ?function } 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @crossplatform 204 * @atomicservice 205 * @since 12 206 */ 207 action?: () => void; 208} 209 210/** 211 * Defines the prefix icon option. 212 * 213 * @interface PrefixIconOptions 214 * @extends IconCommonOptions 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @crossplatform 217 * @since 11 218 */ 219 /** 220 * Defines the prefix icon option. 221 * 222 * @interface PrefixIconOptions 223 * @extends IconCommonOptions 224 * @syscap SystemCapability.ArkUI.ArkUI.Full 225 * @crossplatform 226 * @atomicservice 227 * @since 12 228 */ 229export interface PrefixIconOptions extends IconCommonOptions {} 230 231/** 232 * Defines chip symbolglyph options. 233 * 234 * @interface ChipSymbolGlyphOptions 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @crossplatform 237 * @atomicservice 238 * @since 12 239 */ 240export interface ChipSymbolGlyphOptions { 241 242 /** 243 * Symbol normal. 244 * 245 * @type { ?SymbolGlyphModifier } 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @crossplatform 248 * @atomicservice 249 * @since 12 250 */ 251 normal?: SymbolGlyphModifier; 252 253 /** 254 * Symbol activated. 255 * 256 * @type { ?SymbolGlyphModifier } 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @crossplatform 259 * @atomicservice 260 * @since 12 261 */ 262 activated?: SymbolGlyphModifier; 263} 264 265/** 266 * Defines label margin. 267 * 268 * @interface LabelMarginOptions 269 * @syscap SystemCapability.ArkUI.ArkUI.Full 270 * @crossplatform 271 * @since 11 272 */ 273 /** 274 * Defines label margin. 275 * 276 * @interface LabelMarginOptions 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @crossplatform 279 * @atomicservice 280 * @since 12 281 */ 282export interface LabelMarginOptions { 283 284 /** 285 * Left label margin length. 286 * 287 * @type { ?Dimension } 288 * @syscap SystemCapability.ArkUI.ArkUI.Full 289 * @crossplatform 290 * @since 11 291 */ 292 /** 293 * Left label margin length. 294 * 295 * @type { ?Dimension } 296 * @syscap SystemCapability.ArkUI.ArkUI.Full 297 * @crossplatform 298 * @atomicservice 299 * @since 12 300 */ 301 left?: Dimension; 302 303 /** 304 * Right label margin length. 305 * 306 * @type { ?Dimension } 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @crossplatform 309 * @since 11 310 */ 311 /** 312 * Right label margin length. 313 * 314 * @type { ?Dimension } 315 * @syscap SystemCapability.ArkUI.ArkUI.Full 316 * @crossplatform 317 * @atomicservice 318 * @since 12 319 */ 320 right?: Dimension; 321} 322 323/** 324 * Defines localized label margin. 325 * 326 * @interface LocalizedLabelMarginOptions 327 * @syscap SystemCapability.ArkUI.ArkUI.Full 328 * @crossplatform 329 * @atomicservice 330 * @since 12 331 */ 332export interface LocalizedLabelMarginOptions { 333 334 /** 335 * start localized label margin length. 336 * 337 * @type { ?LengthMetrics } 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @crossplatform 340 * @atomicservice 341 * @since 12 342 */ 343 start?: LengthMetrics; 344 345 /** 346 * end localized label margin length. 347 * 348 * @type { ?LengthMetrics } 349 * @syscap SystemCapability.ArkUI.ArkUI.Full 350 * @crossplatform 351 * @atomicservice 352 * @since 12 353 */ 354 end?: LengthMetrics; 355} 356 357/** 358 * Defines label option. 359 * 360 * @interface LabelOptions 361 * @syscap SystemCapability.ArkUI.ArkUI.Full 362 * @crossplatform 363 * @since 11 364 */ 365 /** 366 * Defines label option. 367 * 368 * @interface LabelOptions 369 * @syscap SystemCapability.ArkUI.ArkUI.Full 370 * @crossplatform 371 * @atomicservice 372 * @since 12 373 */ 374export interface LabelOptions { 375 376 /** 377 * Text content. 378 * 379 * @type { string } 380 * @syscap SystemCapability.ArkUI.ArkUI.Full 381 * @crossplatform 382 * @since 11 383 */ 384 /** 385 * Text content. 386 * 387 * @type { string } 388 * @syscap SystemCapability.ArkUI.ArkUI.Full 389 * @crossplatform 390 * @atomicservice 391 * @since 12 392 */ 393 text: string; 394 395 /** 396 * Text font size. 397 * 398 * @type { ?Dimension } 399 * @syscap SystemCapability.ArkUI.ArkUI.Full 400 * @crossplatform 401 * @since 11 402 */ 403 /** 404 * Text font size. 405 * 406 * @type { ?Dimension } 407 * @syscap SystemCapability.ArkUI.ArkUI.Full 408 * @crossplatform 409 * @atomicservice 410 * @since 12 411 */ 412 fontSize?: Dimension; 413 414 /** 415 * Text font color. 416 * 417 * @type { ?ResourceColor } 418 * @syscap SystemCapability.ArkUI.ArkUI.Full 419 * @crossplatform 420 * @since 11 421 */ 422 /** 423 * Text font color. 424 * 425 * @type { ?ResourceColor } 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @crossplatform 428 * @atomicservice 429 * @since 12 430 */ 431 fontColor?: ResourceColor; 432 433 /** 434 * Text font color when chip is activated. 435 * 436 * @type { ?ResourceColor } 437 * @syscap SystemCapability.ArkUI.ArkUI.Full 438 * @crossplatform 439 * @atomicservice 440 * @since 12 441 */ 442 activatedFontColor?: ResourceColor; 443 444 /** 445 * Text font family. 446 * 447 * @type { ?string } 448 * @syscap SystemCapability.ArkUI.ArkUI.Full 449 * @crossplatform 450 * @since 11 451 */ 452 /** 453 * Text font family. 454 * 455 * @type { ?string } 456 * @syscap SystemCapability.ArkUI.ArkUI.Full 457 * @crossplatform 458 * @atomicservice 459 * @since 12 460 */ 461 fontFamily?: string; 462 463 /** 464 * Label margin. 465 * 466 * @type { ?LabelMarginOptions } 467 * @syscap SystemCapability.ArkUI.ArkUI.Full 468 * @crossplatform 469 * @since 11 470 */ 471 /** 472 * Label margin. 473 * 474 * @type { ?LabelMarginOptions } 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @crossplatform 477 * @atomicservice 478 * @since 12 479 */ 480 labelMargin?: LabelMarginOptions; 481 482 /** 483 * Localized label margin. 484 * 485 * @type { ?LocalizedLabelMarginOptions } 486 * @syscap SystemCapability.ArkUI.ArkUI.Full 487 * @crossplatform 488 * @atomicservice 489 * @since 12 490 */ 491 localizedLabelMargin?: LocalizedLabelMarginOptions; 492} 493 494/** 495 * Defines chip options. 496 * 497 * @interface ChipOptions 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @crossplatform 500 * @since 11 501 */ 502 /** 503 * Defines chip options. 504 * 505 * @interface ChipOptions 506 * @syscap SystemCapability.ArkUI.ArkUI.Full 507 * @crossplatform 508 * @atomicservice 509 * @since 12 510 */ 511export interface ChipOptions { 512 /** 513 * Chip prefix icon. 514 * 515 * @type { ?PrefixIconOptions } 516 * @syscap SystemCapability.ArkUI.ArkUI.Full 517 * @crossplatform 518 * @since 11 519 */ 520 /** 521 * Chip prefix icon. 522 * 523 * @type { ?PrefixIconOptions } 524 * @syscap SystemCapability.ArkUI.ArkUI.Full 525 * @crossplatform 526 * @atomicservice 527 * @since 12 528 */ 529 prefixIcon?: PrefixIconOptions; 530 531 /** 532 * Chip prefix symbol. 533 * 534 * @type { ?ChipSymbolGlyphOptions } 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @atomicservice 538 * @since 12 539 */ 540 prefixSymbol?: ChipSymbolGlyphOptions; 541 542 /** 543 * Chip label. 544 * 545 * @type { LabelOptions } 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @since 11 549 */ 550 /** 551 * Chip label. 552 * 553 * @type { LabelOptions } 554 * @syscap SystemCapability.ArkUI.ArkUI.Full 555 * @crossplatform 556 * @atomicservice 557 * @since 12 558 */ 559 label: LabelOptions; 560 561 /** 562 * Chip suffix icon. 563 * 564 * @type { ?SuffixIconOptions } 565 * @syscap SystemCapability.ArkUI.ArkUI.Full 566 * @crossplatform 567 * @since 11 568 */ 569 /** 570 * Chip suffix icon. 571 * 572 * @type { ?SuffixIconOptions } 573 * @syscap SystemCapability.ArkUI.ArkUI.Full 574 * @crossplatform 575 * @atomicservice 576 * @since 12 577 */ 578 suffixIcon?: SuffixIconOptions; 579 580 /** 581 * Chip suffix symbol. 582 * 583 * @type { ?ChipSymbolGlyphOptions } 584 * @syscap SystemCapability.ArkUI.ArkUI.Full 585 * @crossplatform 586 * @atomicservice 587 * @since 12 588 */ 589 suffixSymbol?: ChipSymbolGlyphOptions; 590 591 /** 592 * Show close icon. 593 * 594 * @type { ?boolean } 595 * @syscap SystemCapability.ArkUI.ArkUI.Full 596 * @crossplatform 597 * @since 11 598 */ 599 /** 600 * Show close icon. 601 * 602 * @type { ?boolean } 603 * @syscap SystemCapability.ArkUI.ArkUI.Full 604 * @crossplatform 605 * @atomicservice 606 * @since 12 607 */ 608 allowClose?: boolean; 609 610 /** 611 * Enable chip. 612 * 613 * @type { ?boolean } 614 * @syscap SystemCapability.ArkUI.ArkUI.Full 615 * @crossplatform 616 * @since 11 617 */ 618 /** 619 * Enable chip. 620 * 621 * @type { ?boolean } 622 * @syscap SystemCapability.ArkUI.ArkUI.Full 623 * @crossplatform 624 * @atomicservice 625 * @since 12 626 */ 627 enabled?: boolean; 628 629 /** 630 * Set whether chip is active or not. 631 * 632 * @type { ?boolean } 633 * @syscap SystemCapability.ArkUI.ArkUI.Full 634 * @crossplatform 635 * @atomicservice 636 * @since 12 637 */ 638 activated?: boolean; 639 640 /** 641 * Chip background color. 642 * 643 * @type { ?ResourceColor } 644 * @syscap SystemCapability.ArkUI.ArkUI.Full 645 * @crossplatform 646 * @since 11 647 */ 648 /** 649 * Chip background color. 650 * 651 * @type { ?ResourceColor } 652 * @syscap SystemCapability.ArkUI.ArkUI.Full 653 * @crossplatform 654 * @atomicservice 655 * @since 12 656 */ 657 backgroundColor?: ResourceColor; 658 659 /** 660 * Chip background color when chip is activated. 661 * 662 * @type { ?ResourceColor } 663 * @syscap SystemCapability.ArkUI.ArkUI.Full 664 * @crossplatform 665 * @atomicservice 666 * @since 12 667 */ 668 activatedBackgroundColor?: ResourceColor; 669 670 /** 671 * Chip radius. 672 * 673 * @type { ?Dimension } 674 * @syscap SystemCapability.ArkUI.ArkUI.Full 675 * @crossplatform 676 * @since 11 677 */ 678 /** 679 * Chip radius. 680 * 681 * @type { ?Dimension } 682 * @syscap SystemCapability.ArkUI.ArkUI.Full 683 * @crossplatform 684 * @atomicservice 685 * @since 12 686 */ 687 borderRadius?: Dimension; 688 689 /** 690 * Chip size. 691 * 692 * @type { ?ChipSize | SizeOptions } 693 * @syscap SystemCapability.ArkUI.ArkUI.Full 694 * @crossplatform 695 * @since 11 696 */ 697 /** 698 * Chip size. 699 * 700 * @type { ?ChipSize | SizeOptions } 701 * @syscap SystemCapability.ArkUI.ArkUI.Full 702 * @crossplatform 703 * @atomicservice 704 * @since 12 705 */ 706 size?: ChipSize | SizeOptions; 707 708 /** 709 * On close action. 710 * 711 * @type { ?function } 712 * @syscap SystemCapability.ArkUI.ArkUI.Full 713 * @crossplatform 714 * @since 11 715 */ 716 /** 717 * On close action. 718 * 719 * @type { ?function } 720 * @syscap SystemCapability.ArkUI.ArkUI.Full 721 * @crossplatform 722 * @atomicservice 723 * @since 12 724 */ 725 onClose?: () => void; 726 727 /** 728 * On clicked action. 729 * 730 * @type { ?Callback<void> } 731 * @syscap SystemCapability.ArkUI.ArkUI.Full 732 * @crossplatform 733 * @atomicservice 734 * @since 12 735 */ 736 onClicked?: Callback<void>; 737 738 /** 739 * Indicates the attribute of the current chip direction. 740 * 741 * @type { ?Direction } 742 * @syscap SystemCapability.ArkUI.ArkUI.Full 743 * @crossplatform 744 * @atomicservice 745 * @since 12 746 */ 747 direction?: Direction; 748} 749 750/** 751 * Build function of Chip. 752 * 753 * @param { ChipOptions } options - chip option. 754 * @syscap SystemCapability.ArkUI.ArkUI.Full 755 * @crossplatform 756 * @since 11 757 */ 758 /** 759 * Build function of Chip. 760 * 761 * @param { ChipOptions } options - chip option. 762 * @syscap SystemCapability.ArkUI.ArkUI.Full 763 * @crossplatform 764 * @atomicservice 765 * @since 12 766 */ 767@Builder 768export declare function Chip(options: ChipOptions): void;