1/* 2 * Copyright (c) 2021-2024 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/*** if arkts 1.2 */ 22import { Resource } from '../../global/resource'; 23import { ResourceStr, ResourceColor, Length, Font } from './units'; 24import { TextOverflow, FontWeight, FontStyle, TextHeightAdaptivePolicy } from './enums'; 25import { CommonConfiguration, CommonMethod, ContentModifier } from './common'; 26/*** endif */ 27 28/** 29 * Provides a button component. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @since 7 34 */ 35/** 36 * Provides a button component. 37 * 38 * @enum { number } 39 * @syscap SystemCapability.ArkUI.ArkUI.Full 40 * @form 41 * @since 9 42 */ 43/** 44 * Provides a button component. 45 * 46 * @enum { number } 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @crossplatform 49 * @form 50 * @since 10 51 */ 52/** 53 * Provides a button component. 54 * 55 * @enum { number } 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @crossplatform 58 * @form 59 * @atomicservice 60 * @since arkts {'1.1':'11','1.2':'20'} 61 * @arkts 1.1&1.2 62 */ 63declare enum ButtonType { 64 /** 65 * Capsule button (rounded corners default to half the height). 66 * 67 * @syscap SystemCapability.ArkUI.ArkUI.Full 68 * @since 7 69 */ 70 /** 71 * Capsule button (rounded corners default to half the height). 72 * 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @form 75 * @since 9 76 */ 77 /** 78 * Capsule button (rounded corners default to half the height). 79 * 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @crossplatform 82 * @form 83 * @since 10 84 */ 85 /** 86 * Capsule button (rounded corners default to half the height). 87 * 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @crossplatform 90 * @form 91 * @atomicservice 92 * @since arkts {'1.1':'11','1.2':'20'} 93 * @arkts 1.1&1.2 94 */ 95 Capsule, 96 97 /** 98 * Round buttons. 99 * 100 * @syscap SystemCapability.ArkUI.ArkUI.Full 101 * @since 7 102 */ 103 /** 104 * Round buttons. 105 * 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @form 108 * @since 9 109 */ 110 /** 111 * Round buttons. 112 * 113 * @syscap SystemCapability.ArkUI.ArkUI.Full 114 * @crossplatform 115 * @form 116 * @since 10 117 */ 118 /** 119 * Round buttons. 120 * 121 * @syscap SystemCapability.ArkUI.ArkUI.Full 122 * @crossplatform 123 * @form 124 * @atomicservice 125 * @since arkts {'1.1':'11','1.2':'20'} 126 * @arkts 1.1&1.2 127 */ 128 Circle, 129 130 /** 131 * Common button (no rounded corners by default). 132 * 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @since 7 135 */ 136 /** 137 * Common button (no rounded corners by default). 138 * 139 * @syscap SystemCapability.ArkUI.ArkUI.Full 140 * @form 141 * @since 9 142 */ 143 /** 144 * Common button (no rounded corners by default). 145 * 146 * @syscap SystemCapability.ArkUI.ArkUI.Full 147 * @crossplatform 148 * @form 149 * @since 10 150 */ 151 /** 152 * Common button (no rounded corners by default). 153 * 154 * @syscap SystemCapability.ArkUI.ArkUI.Full 155 * @crossplatform 156 * @form 157 * @atomicservice 158 * @since arkts {'1.1':'11','1.2':'20'} 159 * @arkts 1.1&1.2 160 */ 161 Normal, 162 163 /** 164 * Rounded rectangle button. 165 * 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @crossplatform 168 * @form 169 * @atomicservice 170 * @since arkts {'1.1':'15','1.2':'20'} 171 * @arkts 1.1&1.2 172 */ 173 ROUNDED_RECTANGLE = 3, 174} 175 176/** 177 * Enum for button style type. 178 * 179 * @enum { number } 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @crossplatform 182 * @form 183 * @since 11 184 */ 185/** 186 * Enum for button style type. 187 * 188 * @enum { number } 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @crossplatform 191 * @form 192 * @atomicservice 193 * @since arkts {'1.1':'12','1.2':'20'} 194 * @arkts 1.1&1.2 195 */ 196declare enum ButtonStyleMode { 197 /** 198 * Normal button (with normal background color). 199 * 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @crossplatform 202 * @form 203 * @since 11 204 */ 205 /** 206 * Normal button (with normal background color). 207 * 208 * @syscap SystemCapability.ArkUI.ArkUI.Full 209 * @crossplatform 210 * @form 211 * @atomicservice 212 * @since arkts {'1.1':'12','1.2':'20'} 213 * @arkts 1.1&1.2 214 */ 215 NORMAL = 0, 216 217 /** 218 * Emphasized button (with emphasized background color). 219 * 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @crossplatform 222 * @form 223 * @since 11 224 */ 225 /** 226 * Emphasized button (with emphasized background color). 227 * 228 * @syscap SystemCapability.ArkUI.ArkUI.Full 229 * @crossplatform 230 * @form 231 * @atomicservice 232 * @since arkts {'1.1':'12','1.2':'20'} 233 * @arkts 1.1&1.2 234 */ 235 EMPHASIZED = 1, 236 237 /** 238 * Textual button (with none background color). 239 * 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @crossplatform 242 * @form 243 * @since 11 244 */ 245 /** 246 * Textual button (with none background color). 247 * 248 * @syscap SystemCapability.ArkUI.ArkUI.Full 249 * @crossplatform 250 * @form 251 * @atomicservice 252 * @since arkts {'1.1':'12','1.2':'20'} 253 * @arkts 1.1&1.2 254 */ 255 TEXTUAL = 2, 256} 257 258/** 259 * Enum for button role. 260 * 261 * @enum { number } 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @crossplatform 264 * @form 265 * @atomicservice 266 * @since arkts {'1.1':'12','1.2':'20'} 267 * @arkts 1.1&1.2 268 */ 269declare enum ButtonRole { 270 /** 271 * Normal button. 272 * 273 * @syscap SystemCapability.ArkUI.ArkUI.Full 274 * @crossplatform 275 * @form 276 * @atomicservice 277 * @since arkts {'1.1':'12','1.2':'20'} 278 * @arkts 1.1&1.2 279 */ 280 NORMAL = 0, 281 282 /** 283 * Error button. 284 * 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @crossplatform 287 * @form 288 * @atomicservice 289 * @since arkts {'1.1':'12','1.2':'20'} 290 * @arkts 1.1&1.2 291 */ 292 ERROR = 1, 293} 294 295/** 296 * Defines the callback type used in ButtonConfiguration. 297 * 298 * @typedef {function} ButtonTriggerClickCallback 299 * @param { number } xPos - The value of xPos is x coordinate. 300 * @param { number } yPos - The value of yPos is y coordinate. 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @crossplatform 303 * @atomicservice 304 * @since arkts {'1.1':'12','1.2':'20'} 305 * @arkts 1.1&1.2 306 */ 307declare type ButtonTriggerClickCallback = (xPos: number, yPos: number) => void; 308 309/** 310 * ButtonConfiguration used by button content modifier. 311 * 312 * @extends CommonConfiguration<ButtonConfiguration> 313 * @interface ButtonConfiguration 314 * @syscap SystemCapability.ArkUI.ArkUI.Full 315 * @crossplatform 316 * @atomicservice 317 * @since arkts {'1.1':'12','1.2':'20'} 318 * @arkts 1.1&1.2 319 */ 320 321declare interface ButtonConfiguration extends CommonConfiguration<ButtonConfiguration> { 322 /** 323 * Button with inner text label. 324 * 325 * @type { string } 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @atomicservice 329 * @since arkts {'1.1':'12','1.2':'20'} 330 * @arkts 1.1&1.2 331 */ 332 label: string; 333 334 /** 335 * Indicates whether the button is pressed. 336 * 337 * @type { boolean } 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @crossplatform 340 * @atomicservice 341 * @since arkts {'1.1':'12','1.2':'20'} 342 * @arkts 1.1&1.2 343 */ 344 pressed: boolean; 345 346 /** 347 * Trigger button click x coordinate and y coordinate. 348 * 349 * @type { ButtonTriggerClickCallback } 350 * @syscap SystemCapability.ArkUI.ArkUI.Full 351 * @crossplatform 352 * @atomicservice 353 * @since arkts {'1.1':'12','1.2':'20'} 354 * @arkts 1.1&1.2 355 */ 356 triggerClick: ButtonTriggerClickCallback; 357} 358 359/** 360 * Enum for Control Size. 361 * 362 * @enum { string } 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @crossplatform 365 * @form 366 * @since 11 367 */ 368/** 369 * Enum for Control Size. 370 * 371 * @enum { string } 372 * @syscap SystemCapability.ArkUI.ArkUI.Full 373 * @crossplatform 374 * @form 375 * @atomicservice 376 * @since arkts {'1.1':'12','1.2':'20'} 377 * @arkts 1.1&1.2 378 */ 379declare enum ControlSize { 380 /** 381 * The component size is small. 382 * 383 * @syscap SystemCapability.ArkUI.ArkUI.Full 384 * @crossplatform 385 * @form 386 * @since 11 387 */ 388 /** 389 * The component size is small. 390 * 391 * @syscap SystemCapability.ArkUI.ArkUI.Full 392 * @crossplatform 393 * @form 394 * @atomicservice 395 * @since arkts {'1.1':'12','1.2':'20'} 396 * @arkts 1.1&1.2 397 */ 398 SMALL = 'small', 399 400 /** 401 * The component size is normal. 402 * 403 * @syscap SystemCapability.ArkUI.ArkUI.Full 404 * @crossplatform 405 * @form 406 * @since 11 407 */ 408 /** 409 * The component size is normal. 410 * 411 * @syscap SystemCapability.ArkUI.ArkUI.Full 412 * @crossplatform 413 * @form 414 * @atomicservice 415 * @since arkts {'1.1':'12','1.2':'20'} 416 * @arkts 1.1&1.2 417 */ 418 NORMAL = 'normal', 419} 420 421/** 422 * Defines the button options. 423 * 424 * @interface ButtonOptions 425 * @syscap SystemCapability.ArkUI.ArkUI.Full 426 * @since 7 427 */ 428/** 429 * Defines the button options. 430 * 431 * @interface ButtonOptions 432 * @syscap SystemCapability.ArkUI.ArkUI.Full 433 * @form 434 * @since 9 435 */ 436/** 437 * Defines the button options. 438 * 439 * @interface ButtonOptions 440 * @syscap SystemCapability.ArkUI.ArkUI.Full 441 * @crossplatform 442 * @form 443 * @since 10 444 */ 445/** 446 * Defines the button options. 447 * 448 * @interface ButtonOptions 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @crossplatform 451 * @form 452 * @atomicservice 453 * @since arkts {'1.1':'11','1.2':'20'} 454 * @arkts 1.1&1.2 455 */ 456declare interface ButtonOptions { 457 /** 458 * Describes the button style. 459 * 460 * @type { ?ButtonType } 461 * @syscap SystemCapability.ArkUI.ArkUI.Full 462 * @since 7 463 */ 464 /** 465 * Describes the button style. 466 * 467 * @type { ?ButtonType } 468 * @syscap SystemCapability.ArkUI.ArkUI.Full 469 * @form 470 * @since 9 471 */ 472 /** 473 * Describes the button style. 474 * 475 * @type { ?ButtonType } 476 * @syscap SystemCapability.ArkUI.ArkUI.Full 477 * @crossplatform 478 * @form 479 * @since 10 480 */ 481 /** 482 * Describes the button style. 483 * 484 * @type { ?ButtonType } 485 * @syscap SystemCapability.ArkUI.ArkUI.Full 486 * @crossplatform 487 * @form 488 * @atomicservice 489 * @since arkts {'1.1':'11','1.2':'20'} 490 * @arkts 1.1&1.2 491 */ 492 type?: ButtonType; 493 494 /** 495 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 496 * 497 * @type { ?boolean } 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @since 7 500 */ 501 /** 502 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 503 * 504 * @type { ?boolean } 505 * @syscap SystemCapability.ArkUI.ArkUI.Full 506 * @form 507 * @since 9 508 */ 509 /** 510 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 511 * 512 * @type { ?boolean } 513 * @syscap SystemCapability.ArkUI.ArkUI.Full 514 * @crossplatform 515 * @form 516 * @since 10 517 */ 518 /** 519 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 520 * 521 * @type { ?boolean } 522 * @syscap SystemCapability.ArkUI.ArkUI.Full 523 * @crossplatform 524 * @form 525 * @atomicservice 526 * @since arkts {'1.1':'11','1.2':'20'} 527 * @arkts 1.1&1.2 528 */ 529 stateEffect?: boolean; 530 531 /** 532 * Describes the button style. 533 * 534 * @type { ?ButtonStyleMode } 535 * @default ButtonStyleMode.EMPHASIZED 536 * @syscap SystemCapability.ArkUI.ArkUI.Full 537 * @crossplatform 538 * @form 539 * @since 11 540 */ 541 /** 542 * Describes the button style. 543 * 544 * @type { ?ButtonStyleMode } 545 * @default ButtonStyleMode.EMPHASIZED 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @form 549 * @atomicservice 550 * @since arkts {'1.1':'12','1.2':'20'} 551 * @arkts 1.1&1.2 552 */ 553 buttonStyle?: ButtonStyleMode; 554 555 /** 556 * Describes the button size. 557 * 558 * @type { ?ControlSize } 559 * @default ControlSize.NORMAL 560 * @syscap SystemCapability.ArkUI.ArkUI.Full 561 * @crossplatform 562 * @form 563 * @since 11 564 */ 565 /** 566 * Describes the button size. 567 * 568 * @type { ?ControlSize } 569 * @default ControlSize.NORMAL 570 * @syscap SystemCapability.ArkUI.ArkUI.Full 571 * @crossplatform 572 * @form 573 * @atomicservice 574 * @since arkts {'1.1':'12','1.2':'20'} 575 * @arkts 1.1&1.2 576 */ 577 controlSize?: ControlSize; 578 579 /** 580 * Describes the button role. 581 * 582 * @type { ?ButtonRole } 583 * @default ButtonRole.NORMAL 584 * @syscap SystemCapability.ArkUI.ArkUI.Full 585 * @crossplatform 586 * @form 587 * @atomicservice 588 * @since arkts {'1.1':'12','1.2':'20'} 589 * @arkts 1.1&1.2 590 */ 591 role?: ButtonRole; 592} 593 594/** 595 * Defines the Button Component. 596 * 597 * @interface ButtonInterface 598 * @syscap SystemCapability.ArkUI.ArkUI.Full 599 * @since 7 600 */ 601/** 602 * Defines the Button Component. 603 * 604 * @interface ButtonInterface 605 * @syscap SystemCapability.ArkUI.ArkUI.Full 606 * @form 607 * @since 9 608 */ 609/** 610 * Defines the Button Component. 611 * 612 * @interface ButtonInterface 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @form 616 * @since 10 617 */ 618/** 619 * Defines the Button Component. 620 * 621 * @interface ButtonInterface 622 * @syscap SystemCapability.ArkUI.ArkUI.Full 623 * @crossplatform 624 * @form 625 * @atomicservice 626 * @since arkts {'1.1':'11','1.2':'20'} 627 * @arkts 1.1&1.2 628 */ 629interface ButtonInterface { 630 /** 631 * Button object 632 * 633 * @returns { ButtonAttribute } 634 * @syscap SystemCapability.ArkUI.ArkUI.Full 635 * @since 7 636 */ 637 /** 638 * Button object 639 * 640 * @returns { ButtonAttribute } 641 * @syscap SystemCapability.ArkUI.ArkUI.Full 642 * @form 643 * @since 9 644 */ 645 /** 646 * Button object 647 * 648 * @returns { ButtonAttribute } 649 * @syscap SystemCapability.ArkUI.ArkUI.Full 650 * @crossplatform 651 * @form 652 * @since 10 653 */ 654 /** 655 * Button object 656 * 657 * @returns { ButtonAttribute } 658 * @syscap SystemCapability.ArkUI.ArkUI.Full 659 * @crossplatform 660 * @form 661 * @atomicservice 662 * @since arkts {'1.1':'11','1.2':'20'} 663 * @arkts 1.1&1.2 664 */ 665 (): ButtonAttribute; 666 667 /** 668 * Create Button with Text child. 669 * 670 * @param { ButtonOptions } options 671 * @returns { ButtonAttribute } 672 * @syscap SystemCapability.ArkUI.ArkUI.Full 673 * @since 7 674 */ 675 /** 676 * Create Button with Text child. 677 * 678 * @param { ButtonOptions } options 679 * @returns { ButtonAttribute } 680 * @syscap SystemCapability.ArkUI.ArkUI.Full 681 * @form 682 * @since 9 683 */ 684 /** 685 * Create Button with Text child. 686 * 687 * @param { ButtonOptions } options 688 * @returns { ButtonAttribute } 689 * @syscap SystemCapability.ArkUI.ArkUI.Full 690 * @crossplatform 691 * @form 692 * @since 10 693 */ 694 /** 695 * Create Button with Text child. 696 * 697 * @param { ButtonOptions } options 698 * @returns { ButtonAttribute } 699 * @syscap SystemCapability.ArkUI.ArkUI.Full 700 * @crossplatform 701 * @form 702 * @atomicservice 703 * @since arkts {'1.1':'11','1.2':'20'} 704 * @arkts 1.1&1.2 705 */ 706 (options: ButtonOptions): ButtonAttribute; 707 708 /** 709 * Create Button with inner text label. 710 * 711 * @param { ResourceStr } label 712 * @param { ButtonOptions } options 713 * @returns { ButtonAttribute } 714 * @syscap SystemCapability.ArkUI.ArkUI.Full 715 * @since 7 716 */ 717 /** 718 * Create Button with inner text label. 719 * 720 * @param { ResourceStr } label 721 * @param { ButtonOptions } options 722 * @returns { ButtonAttribute } 723 * @syscap SystemCapability.ArkUI.ArkUI.Full 724 * @form 725 * @since 9 726 */ 727 /** 728 * Create Button with inner text label. 729 * 730 * @param { ResourceStr } label 731 * @param { ButtonOptions } options 732 * @returns { ButtonAttribute } 733 * @syscap SystemCapability.ArkUI.ArkUI.Full 734 * @crossplatform 735 * @form 736 * @since 10 737 */ 738 /** 739 * Create Button with inner text label. 740 * 741 * @param { ResourceStr } label 742 * @param { ButtonOptions } options 743 * @returns { ButtonAttribute } 744 * @syscap SystemCapability.ArkUI.ArkUI.Full 745 * @crossplatform 746 * @form 747 * @atomicservice 748 * @since arkts {'1.1':'11','1.2':'20'} 749 * @arkts 1.1&1.2 750 */ 751 (label: ResourceStr, options?: ButtonOptions): ButtonAttribute; 752} 753 754/** 755 * LabelStyle object. 756 * 757 * @interface LabelStyle 758 * @syscap SystemCapability.ArkUI.ArkUI.Full 759 * @crossplatform 760 * @since 10 761 */ 762/** 763 * LabelStyle object. 764 * 765 * @interface LabelStyle 766 * @syscap SystemCapability.ArkUI.ArkUI.Full 767 * @crossplatform 768 * @atomicservice 769 * @since 11 770 */ 771declare interface LabelStyle { 772 /** 773 * overflow mode. 774 * 775 * @type { ?TextOverflow } 776 * @syscap SystemCapability.ArkUI.ArkUI.Full 777 * @crossplatform 778 * @since 10 779 */ 780 /** 781 * overflow mode. 782 * 783 * @type { ?TextOverflow } 784 * @syscap SystemCapability.ArkUI.ArkUI.Full 785 * @crossplatform 786 * @atomicservice 787 * @since 11 788 */ 789 overflow?: TextOverflow; 790 791 /** 792 * Label max lines. 793 * 794 * @type { ?number } 795 * @syscap SystemCapability.ArkUI.ArkUI.Full 796 * @crossplatform 797 * @since 10 798 */ 799 /** 800 * Label max lines. 801 * 802 * @type { ?number } 803 * @syscap SystemCapability.ArkUI.ArkUI.Full 804 * @crossplatform 805 * @atomicservice 806 * @since 11 807 */ 808 maxLines?: number; 809 810 /** 811 * Min font size for adapted height. 812 * 813 * @type { ?(number | ResourceStr) } 814 * @syscap SystemCapability.ArkUI.ArkUI.Full 815 * @crossplatform 816 * @since 10 817 */ 818 /** 819 * Min font size for adapted height. 820 * 821 * @type { ?(number | ResourceStr) } 822 * @syscap SystemCapability.ArkUI.ArkUI.Full 823 * @crossplatform 824 * @atomicservice 825 * @since 11 826 */ 827 minFontSize?: number | ResourceStr; 828 829 /** 830 * Max font size for adapted height. 831 * 832 * @type { ?(number | ResourceStr) } 833 * @syscap SystemCapability.ArkUI.ArkUI.Full 834 * @crossplatform 835 * @since 10 836 */ 837 /** 838 * Max font size for adapted height. 839 * 840 * @type { ?(number | ResourceStr) } 841 * @syscap SystemCapability.ArkUI.ArkUI.Full 842 * @crossplatform 843 * @atomicservice 844 * @since 11 845 */ 846 maxFontSize?: number | ResourceStr; 847 848 /** 849 * Adapt text height option. 850 * 851 * @type { ?TextHeightAdaptivePolicy } 852 * @syscap SystemCapability.ArkUI.ArkUI.Full 853 * @crossplatform 854 * @since 10 855 */ 856 /** 857 * Adapt text height option. 858 * 859 * @type { ?TextHeightAdaptivePolicy } 860 * @syscap SystemCapability.ArkUI.ArkUI.Full 861 * @crossplatform 862 * @atomicservice 863 * @since 11 864 */ 865 heightAdaptivePolicy?: TextHeightAdaptivePolicy; 866 867 /** 868 * Font style. 869 * 870 * @type { ?Font } 871 * @syscap SystemCapability.ArkUI.ArkUI.Full 872 * @crossplatform 873 * @since 10 874 */ 875 /** 876 * Font style. 877 * 878 * @type { ?Font } 879 * @syscap SystemCapability.ArkUI.ArkUI.Full 880 * @crossplatform 881 * @atomicservice 882 * @since 11 883 */ 884 font?: Font; 885} 886 887/** 888 * ButtonLabelStyle object. 889 * 890 * @interface ButtonLabelStyle 891 * @syscap SystemCapability.ArkUI.ArkUI.Full 892 * @crossplatform 893 * @atomicservice 894 * @since 20 895 * @arkts 1.2 896 */ 897declare interface ButtonLabelStyle { 898 /** 899 * overflow mode. 900 * 901 * @type { ?TextOverflow } 902 * @syscap SystemCapability.ArkUI.ArkUI.Full 903 * @crossplatform 904 * @atomicservice 905 * @since 20 906 * @arkts 1.2 907 */ 908 overflow?: TextOverflow; 909 910 /** 911 * Label max lines. 912 * 913 * @type { ?number } 914 * @syscap SystemCapability.ArkUI.ArkUI.Full 915 * @crossplatform 916 * @atomicservice 917 * @since 20 918 * @arkts 1.2 919 */ 920 maxLines?: number; 921 922 /** 923 * Min font size for adapted height. 924 * 925 * @type { ?(number | ResourceStr) } 926 * @syscap SystemCapability.ArkUI.ArkUI.Full 927 * @crossplatform 928 * @atomicservice 929 * @since 20 930 * @arkts 1.2 931 */ 932 minFontSize?: number | ResourceStr; 933 934 /** 935 * Max font size for adapted height. 936 * 937 * @type { ?(number | ResourceStr) } 938 * @syscap SystemCapability.ArkUI.ArkUI.Full 939 * @crossplatform 940 * @atomicservice 941 * @since 20 942 * @arkts 1.2 943 */ 944 maxFontSize?: number | ResourceStr; 945 946 /** 947 * Adapt text height option. 948 * 949 * @type { ?TextHeightAdaptivePolicy } 950 * @syscap SystemCapability.ArkUI.ArkUI.Full 951 * @crossplatform 952 * @atomicservice 953 * @since 20 954 * @arkts 1.2 955 */ 956 heightAdaptivePolicy?: TextHeightAdaptivePolicy; 957 958 /** 959 * Font style. 960 * 961 * @type { ?Font } 962 * @syscap SystemCapability.ArkUI.ArkUI.Full 963 * @crossplatform 964 * @atomicservice 965 * @since 20 966 * @arkts 1.2 967 */ 968 font?: Font; 969} 970 971/** 972 * Defines the button attribute functions. 973 * 974 * @extends CommonMethod<ButtonAttribute> 975 * @syscap SystemCapability.ArkUI.ArkUI.Full 976 * @since 7 977 */ 978/** 979 * Defines the button attribute functions. 980 * 981 * @extends CommonMethod<ButtonAttribute> 982 * @syscap SystemCapability.ArkUI.ArkUI.Full 983 * @form 984 * @since 9 985 */ 986/** 987 * Defines the button attribute functions. 988 * 989 * @extends CommonMethod<ButtonAttribute> 990 * @syscap SystemCapability.ArkUI.ArkUI.Full 991 * @crossplatform 992 * @form 993 * @since 10 994 */ 995/** 996 * Defines the button attribute functions. 997 * 998 * @extends CommonMethod<ButtonAttribute> 999 * @syscap SystemCapability.ArkUI.ArkUI.Full 1000 * @crossplatform 1001 * @form 1002 * @atomicservice 1003 * @since arkts {'1.1':'11','1.2':'20'} 1004 * @arkts 1.1&1.2 1005 */ 1006declare class ButtonAttribute extends CommonMethod<ButtonAttribute> { 1007 /** 1008 * Describes the button style. 1009 * 1010 * @param { ButtonType } value 1011 * @returns { ButtonAttribute } 1012 * @syscap SystemCapability.ArkUI.ArkUI.Full 1013 * @since 7 1014 */ 1015 /** 1016 * Describes the button style. 1017 * 1018 * @param { ButtonType } value 1019 * @returns { ButtonAttribute } 1020 * @syscap SystemCapability.ArkUI.ArkUI.Full 1021 * @form 1022 * @since 9 1023 */ 1024 /** 1025 * Describes the button style. 1026 * 1027 * @param { ButtonType } value 1028 * @returns { ButtonAttribute } 1029 * @syscap SystemCapability.ArkUI.ArkUI.Full 1030 * @crossplatform 1031 * @form 1032 * @since 10 1033 */ 1034 /** 1035 * Describes the button style. 1036 * 1037 * @param { ButtonType } value 1038 * @returns { ButtonAttribute } 1039 * @syscap SystemCapability.ArkUI.ArkUI.Full 1040 * @crossplatform 1041 * @form 1042 * @atomicservice 1043 * @since arkts {'1.1':'11','1.2':'20'} 1044 * @arkts 1.1&1.2 1045 */ 1046 type(value: ButtonType): ButtonAttribute; 1047 1048 /** 1049 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 1050 * 1051 * @param { boolean } value 1052 * @returns { ButtonAttribute } 1053 * @syscap SystemCapability.ArkUI.ArkUI.Full 1054 * @since 7 1055 */ 1056 /** 1057 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 1058 * 1059 * @param { boolean } value 1060 * @returns { ButtonAttribute } 1061 * @syscap SystemCapability.ArkUI.ArkUI.Full 1062 * @form 1063 * @since 9 1064 */ 1065 /** 1066 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 1067 * 1068 * @param { boolean } value 1069 * @returns { ButtonAttribute } 1070 * @syscap SystemCapability.ArkUI.ArkUI.Full 1071 * @crossplatform 1072 * @form 1073 * @since 10 1074 */ 1075 /** 1076 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 1077 * 1078 * @param { boolean } value 1079 * @returns { ButtonAttribute } 1080 * @syscap SystemCapability.ArkUI.ArkUI.Full 1081 * @crossplatform 1082 * @form 1083 * @atomicservice 1084 * @since arkts {'1.1':'11','1.2':'20'} 1085 * @arkts 1.1&1.2 1086 */ 1087 stateEffect(value: boolean): ButtonAttribute; 1088 1089 /** 1090 * Describes the button style. 1091 * 1092 * @param { ButtonStyleMode } value - button style mode 1093 * @returns { ButtonAttribute } 1094 * @syscap SystemCapability.ArkUI.ArkUI.Full 1095 * @crossplatform 1096 * @form 1097 * @since 11 1098 */ 1099 /** 1100 * Describes the button style. 1101 * 1102 * @param { ButtonStyleMode } value - button style mode 1103 * @returns { ButtonAttribute } 1104 * @syscap SystemCapability.ArkUI.ArkUI.Full 1105 * @crossplatform 1106 * @form 1107 * @atomicservice 1108 * @since arkts {'1.1':'12','1.2':'20'} 1109 * @arkts 1.1&1.2 1110 */ 1111 buttonStyle(value: ButtonStyleMode): ButtonAttribute; 1112 1113 /** 1114 * Set the Button size. 1115 * 1116 * @param { ControlSize } value - control size 1117 * @returns { ButtonAttribute } 1118 * @syscap SystemCapability.ArkUI.ArkUI.Full 1119 * @crossplatform 1120 * @form 1121 * @since 11 1122 */ 1123 /** 1124 * Set the Button size. 1125 * 1126 * @param { ControlSize } value - control size 1127 * @returns { ButtonAttribute } 1128 * @syscap SystemCapability.ArkUI.ArkUI.Full 1129 * @crossplatform 1130 * @form 1131 * @atomicservice 1132 * @since arkts {'1.1':'12','1.2':'20'} 1133 * @arkts 1.1&1.2 1134 */ 1135 controlSize(value: ControlSize): ButtonAttribute; 1136 1137 /** 1138 * Set the Button role. 1139 * 1140 * @param { ButtonRole } value - button role 1141 * @returns { ButtonAttribute } 1142 * @syscap SystemCapability.ArkUI.ArkUI.Full 1143 * @crossplatform 1144 * @form 1145 * @atomicservice 1146 * @since arkts {'1.1':'12','1.2':'20'} 1147 * @arkts 1.1&1.2 1148 */ 1149 role(value: ButtonRole): ButtonAttribute; 1150 1151 /** 1152 * Text color. 1153 * 1154 * @param { ResourceColor } value 1155 * @returns { ButtonAttribute } 1156 * @syscap SystemCapability.ArkUI.ArkUI.Full 1157 * @since 7 1158 */ 1159 /** 1160 * Text color. 1161 * 1162 * @param { ResourceColor } value 1163 * @returns { ButtonAttribute } 1164 * @syscap SystemCapability.ArkUI.ArkUI.Full 1165 * @form 1166 * @since 9 1167 */ 1168 /** 1169 * Text color. 1170 * 1171 * @param { ResourceColor } value 1172 * @returns { ButtonAttribute } 1173 * @syscap SystemCapability.ArkUI.ArkUI.Full 1174 * @crossplatform 1175 * @form 1176 * @since 10 1177 */ 1178 /** 1179 * Text color. 1180 * 1181 * @param { ResourceColor } value 1182 * @returns { ButtonAttribute } 1183 * @syscap SystemCapability.ArkUI.ArkUI.Full 1184 * @crossplatform 1185 * @form 1186 * @atomicservice 1187 * @since arkts {'1.1':'11','1.2':'20'} 1188 * @arkts 1.1&1.2 1189 */ 1190 fontColor(value: ResourceColor): ButtonAttribute; 1191 1192 /** 1193 * Text size. 1194 * 1195 * @param { Length } value 1196 * @returns { ButtonAttribute } 1197 * @syscap SystemCapability.ArkUI.ArkUI.Full 1198 * @since 7 1199 */ 1200 /** 1201 * Text size. 1202 * 1203 * @param { Length } value 1204 * @returns { ButtonAttribute } 1205 * @syscap SystemCapability.ArkUI.ArkUI.Full 1206 * @form 1207 * @since 9 1208 */ 1209 /** 1210 * Text size. 1211 * 1212 * @param { Length } value 1213 * @returns { ButtonAttribute } 1214 * @syscap SystemCapability.ArkUI.ArkUI.Full 1215 * @crossplatform 1216 * @form 1217 * @since 10 1218 */ 1219 /** 1220 * Text size. 1221 * 1222 * @param { Length } value 1223 * @returns { ButtonAttribute } 1224 * @syscap SystemCapability.ArkUI.ArkUI.Full 1225 * @crossplatform 1226 * @form 1227 * @atomicservice 1228 * @since arkts {'1.1':'11','1.2':'20'} 1229 * @arkts 1.1&1.2 1230 */ 1231 fontSize(value: Length): ButtonAttribute; 1232 1233 /** 1234 * Font weight. 1235 * 1236 * @param { number | FontWeight | string } value 1237 * @returns { ButtonAttribute } 1238 * @syscap SystemCapability.ArkUI.ArkUI.Full 1239 * @since 7 1240 */ 1241 /** 1242 * Font weight. 1243 * 1244 * @param { number | FontWeight | string } value 1245 * @returns { ButtonAttribute } 1246 * @syscap SystemCapability.ArkUI.ArkUI.Full 1247 * @form 1248 * @since 9 1249 */ 1250 /** 1251 * Font weight. 1252 * 1253 * @param { number | FontWeight | string } value 1254 * @returns { ButtonAttribute } 1255 * @syscap SystemCapability.ArkUI.ArkUI.Full 1256 * @crossplatform 1257 * @form 1258 * @since 10 1259 */ 1260 /** 1261 * Font weight. 1262 * 1263 * @param { number | FontWeight | string } value 1264 * @returns { ButtonAttribute } 1265 * @syscap SystemCapability.ArkUI.ArkUI.Full 1266 * @crossplatform 1267 * @form 1268 * @atomicservice 1269 * @since arkts {'1.1':'11','1.2':'20'} 1270 * @arkts 1.1&1.2 1271 */ 1272 fontWeight(value: number | FontWeight | string): ButtonAttribute; 1273 1274 /** 1275 * Font style. 1276 * 1277 * @param { FontStyle } value 1278 * @returns { ButtonAttribute } 1279 * @syscap SystemCapability.ArkUI.ArkUI.Full 1280 * @since 8 1281 */ 1282 /** 1283 * Font style. 1284 * 1285 * @param { FontStyle } value 1286 * @returns { ButtonAttribute } 1287 * @syscap SystemCapability.ArkUI.ArkUI.Full 1288 * @form 1289 * @since 9 1290 */ 1291 /** 1292 * Font style. 1293 * 1294 * @param { FontStyle } value 1295 * @returns { ButtonAttribute } 1296 * @syscap SystemCapability.ArkUI.ArkUI.Full 1297 * @crossplatform 1298 * @form 1299 * @since 10 1300 */ 1301 /** 1302 * Font style. 1303 * 1304 * @param { FontStyle } value 1305 * @returns { ButtonAttribute } 1306 * @syscap SystemCapability.ArkUI.ArkUI.Full 1307 * @crossplatform 1308 * @form 1309 * @atomicservice 1310 * @since arkts {'1.1':'11','1.2':'20'} 1311 * @arkts 1.1&1.2 1312 */ 1313 fontStyle(value: FontStyle): ButtonAttribute; 1314 1315 /** 1316 * Font family. 1317 * 1318 * @param { string | Resource } value 1319 * @returns { ButtonAttribute } 1320 * @syscap SystemCapability.ArkUI.ArkUI.Full 1321 * @since 8 1322 */ 1323 /** 1324 * Font family. 1325 * 1326 * @param { string | Resource } value 1327 * @returns { ButtonAttribute } 1328 * @syscap SystemCapability.ArkUI.ArkUI.Full 1329 * @form 1330 * @since 9 1331 */ 1332 /** 1333 * Font family. 1334 * 1335 * @param { string | Resource } value 1336 * @returns { ButtonAttribute } 1337 * @syscap SystemCapability.ArkUI.ArkUI.Full 1338 * @crossplatform 1339 * @form 1340 * @since 10 1341 */ 1342 /** 1343 * Font family. 1344 * 1345 * @param { string | Resource } value 1346 * @returns { ButtonAttribute } 1347 * @syscap SystemCapability.ArkUI.ArkUI.Full 1348 * @crossplatform 1349 * @form 1350 * @atomicservice 1351 * @since arkts {'1.1':'11','1.2':'20'} 1352 * @arkts 1.1&1.2 1353 */ 1354 fontFamily(value: string | Resource): ButtonAttribute; 1355 1356 /** 1357 * Set the content modifier of button. 1358 * 1359 * @param { ContentModifier<ButtonConfiguration> } modifier - The content modifier of button. 1360 * @returns { ButtonAttribute } 1361 * @syscap SystemCapability.ArkUI.ArkUI.Full 1362 * @crossplatform 1363 * @atomicservice 1364 * @since arkts {'1.1':'12','1.2':'20'} 1365 * @arkts 1.1&1.2 1366 */ 1367 contentModifier(modifier: ContentModifier<ButtonConfiguration>): ButtonAttribute; 1368 1369 /** 1370 * Set button label style. 1371 * 1372 * @param { LabelStyle } value - The label style configuration on button. 1373 * @returns { ButtonAttribute } 1374 * @syscap SystemCapability.ArkUI.ArkUI.Full 1375 * @crossplatform 1376 * @since 10 1377 */ 1378 /** 1379 * Set button label style. 1380 * 1381 * @param { LabelStyle } value - The label style configuration on button. 1382 * @returns { ButtonAttribute } 1383 * @syscap SystemCapability.ArkUI.ArkUI.Full 1384 * @crossplatform 1385 * @atomicservice 1386 * @since 11 1387 */ 1388 labelStyle(value: LabelStyle): ButtonAttribute; 1389 1390 /** 1391 * Set button label style. 1392 * 1393 * @param { ButtonLabelStyle } value - The label style configuration on button. 1394 * @returns { ButtonAttribute } 1395 * @syscap SystemCapability.ArkUI.ArkUI.Full 1396 * @crossplatform 1397 * @atomicservice 1398 * @since 20 1399 * @arkts 1.2 1400 */ 1401 labelStyle(value: ButtonLabelStyle): ButtonAttribute; 1402 1403 /** 1404 * Sets the minimum zoom-out ratio of the button text. 1405 * 1406 * @param { number | Resource } scale 1407 * @returns { ButtonAttribute } 1408 * @syscap SystemCapability.ArkUI.ArkUI.Full 1409 * @atomicservice 1410 * @since 18 1411 */ 1412 /** 1413 * Sets the minimum zoom-out ratio of the button text. 1414 * 1415 * @param { number | Resource } scale 1416 * @returns { ButtonAttribute } 1417 * @syscap SystemCapability.ArkUI.ArkUI.Full 1418 * @crossplatform 1419 * @atomicservice 1420 * @since 20 1421 * @arkts 1.1&1.2 1422 */ 1423 minFontScale(scale: number | Resource): ButtonAttribute; 1424 1425 /** 1426 * Sets the maximum magnification of the button text. 1427 * 1428 * @param { number | Resource } scale 1429 * @returns { ButtonAttribute } 1430 * @syscap SystemCapability.ArkUI.ArkUI.Full 1431 * @atomicservice 1432 * @since 18 1433 */ 1434 /** 1435 * Sets the maximum magnification of the button text. 1436 * 1437 * @param { number | Resource } scale 1438 * @returns { ButtonAttribute } 1439 * @syscap SystemCapability.ArkUI.ArkUI.Full 1440 * @crossplatform 1441 * @atomicservice 1442 * @since 20 1443 * @arkts 1.1&1.2 1444 */ 1445 maxFontScale(scale: number | Resource): ButtonAttribute; 1446} 1447 1448/** 1449 * Defines Button Component. 1450 * 1451 * @syscap SystemCapability.ArkUI.ArkUI.Full 1452 * @since 7 1453 */ 1454/** 1455 * Defines Button Component. 1456 * 1457 * @syscap SystemCapability.ArkUI.ArkUI.Full 1458 * @form 1459 * @since 9 1460 */ 1461/** 1462 * Defines Button Component. 1463 * 1464 * @syscap SystemCapability.ArkUI.ArkUI.Full 1465 * @crossplatform 1466 * @form 1467 * @since 10 1468 */ 1469/** 1470 * Defines Button Component. 1471 * 1472 * @syscap SystemCapability.ArkUI.ArkUI.Full 1473 * @crossplatform 1474 * @form 1475 * @atomicservice 1476 * @since 11 1477 */ 1478declare const Button: ButtonInterface; 1479 1480/** 1481 * Defines Button Component instance. 1482 * 1483 * @syscap SystemCapability.ArkUI.ArkUI.Full 1484 * @since 7 1485 */ 1486/** 1487 * Defines Button Component instance. 1488 * 1489 * @syscap SystemCapability.ArkUI.ArkUI.Full 1490 * @form 1491 * @since 9 1492 */ 1493/** 1494 * Defines Button Component instance. 1495 * 1496 * @syscap SystemCapability.ArkUI.ArkUI.Full 1497 * @crossplatform 1498 * @form 1499 * @since 10 1500 */ 1501/** 1502 * Defines Button Component instance. 1503 * 1504 * @syscap SystemCapability.ArkUI.ArkUI.Full 1505 * @crossplatform 1506 * @form 1507 * @atomicservice 1508 * @since 11 1509 */ 1510declare const ButtonInstance: ButtonAttribute; 1511