Search code examples
antdant-design-pro

ProFormFieldSet affecting ProFormText addonBefore attribute text to disappear?


I am trying to add some text before each Proformtext component, but it is not appearing

Below is my code

  <ProFormFieldSet
     name="firstrow"
     label={<span style={{fontSize: fontSize}}>A</span>}
     labelAlign={labelAlignment}
    >
      <ProFormText
        addonBefore="helloworld"
        labelAlign={labelAlignment}
        width="md"
      />
              =
     <ProFormText
        addonBefore={C}
        width="md" />
  </ProFormFieldSet>

This is the Actual result enter image description here

Expected Result

There is text beside each input.

What I have tried

I took ProFormText component out from ProFormFieldSet and the text appear. anyone know why this is happening??


Solution

  • according to the reference, the props we set for ProFormText are actually for Form.Item, and the fieldProps are for the included Input, remember. pro-form-fields-reference have a try like below

    <ProFormFieldSet
         name="firstrow"
         label={<span style={{fontSize: fontSize}}>A</span>}
         labelAlign={labelAlignment}
        >
          <ProFormText
            fieldProps={{addonBefore:"helloworld"}}
            labelAlign={labelAlignment}
            width="md"
          />
                  =
         <ProFormText
            fieldProps={{addonBefore: C}}
            width="md" />
      </ProFormFieldSet>